Hi guys, could someone please shed some light on how to delete a single Registry Value but leaving the Key that contains it untouched. Thanks
J_E_D_I
Posts
-
How to delete a specific Registry Value -
DialogBox in C++/CLIHi, I can't find any decent example on how to create a DialogBox using C++/CLI and on how to deal with the different responses triggered by the diffent buttons being pressed. I've created graphically the DialogBox (form2) which has 2 buttons "A" and "B" but I can't understand how I can pass different values to the main form (form1) when each button is selected. Is it possible to do it without creating a new class. How? Any example code would be highly appreciated.
-
StreamReader delimiters in C++/CLIHi Dybs, many thanks for the clarification. Now I manage to split the string but still I am unable to set delimiters for StreamReader. I've looked extensively on the web but I can't see pertinent examples for C++/CLI. I would need StreamReader (or
String ^line = reader.ReadLine();
) to read up to the 3rd value of a CSV file and in another instance I need it to stop reading when it meets the end of the line. Do you have any idea on how to specify these delimiters please? I'd really appreciate your help.
-
StreamReader delimiters in C++/CLIHi Dybs, thanks for the reply. However I can't find any good example on the correct syntax for the String.Split method in C++/CLI...Any suggestion is welcome!
-
StreamReader delimiters in C++/CLIHi, I am trying to make my application read fields from a string array (by reading from a .csv file), assign each single field to a new string and then cast it double. I am however having problems setting the delimiters in C+/CLI. The code I previously wrote for C++ (reported at the end) was working file, but I can't find anywhere how to set similar delimiters using C++/CLI.
// Create string array
array<String^>^ Cell= gcnew array<String^>(100);StreamReader^ sr = gcnew StreamReader( "INPUT.csv" );
// Read up to the end of the file
while(sr->Peek() >= 0)
{
for(int i = 0; i<100; i++)
{
// Missing code! What I don't know..
// Should I use Cell= sr.ReadLine().Split(delimiter.ToCharArray()); ?String^ Value0AsString= Cell[i++];
String^ Value1AsString= Cell[i++];
String^ Value2AsString= Cell[i++];double Value0= double:: Parse( Value0AsString);
double Value1= double:: Parse( Value1AsString);
double Value2= double:: Parse( Value2AsString);
}
}The delimiters I would like to use are the following (code in c++):
string Cell[100];
int i = 0;
ifstream INPUT ("INPUT.csv");
while (! INPUT.eof())
{
if ((i + 1) % 3 == 0) getline(INPUT, Cell[i++]);
else getline(INPUT, Cell[i++], '\,');
}
....rest of the codeAny advice is welcome! ;)
-
StreamWriter - How can I write as a .CSV file ?Thanks Navaneeth, However there is an error in the new line command.
outStream.NewLine; //Does not work
outStream.Write(outStream.NewLine); // It works!Cheers.
-
StreamWriter - How can I write as a .CSV file ?Hey Luc, I pressed on "Vote to remove this message" as I thought it could be confusing for other readers and it said your message was reported for abuse! Sorry, that was not my intention!! Mmmmm, better if I take a LOOOOOONG vacation from the forum...
-
StreamWriter - How can I write as a .CSV file ?Sorry Luc, I realized I had written lots of cr*p :~ and I tried to delete my post but unfortunately you replied before I managed to do so! I solved the mystery however. As Mark correctly pointed out I was using the wrong syntax to add a new line without realizing it. I was using
outStream->NewLine; // Which is wrong
Whereas I should have used
outStream->Write(outStream->NewLine);
The "new line" instruction was ignored and I ended up with two items in the same cell using Excel. Thanks to you all guys, problem solved! :)
-
StreamWriter - How can I write as a .CSV file ?[Message Deleted]
-
StreamWriter - How can I write as a .CSV file ?Hi Mark, Your code behaves like mine (although it is written slightly differently) and adds a new line. Therefore the next value is written one cell below (I use Excel by the way, and I have no problems opening CSV files created with the good old C++). What I'd like to do instead is to write the following value next to the first one along the same line. Sorry I wasn't terribly clear in my first post.
-
StreamWriter - How can I write as a .CSV file ?Hi Guys, I need to display this output as "A" in the first cell and "B" in the cell next to it but it does not seem to work as intended. It's all displayed as "A,B" in a single cell! Any idea on how to add a separator please? Cheers.
String^ fName1 = "My File.csv";
StreamWriter^ outStream = File::CreateText(fName1);
outStream->Write("A");
outStream->Write(",");
outStream->Write("B");
outStream->NewLine;
outStream->Close(); -
ifstream & ofstream manipulators equivalents in C++/CLIThanks a million, that was an excellent source of info. It all works apart from the AddText function below.
void AddText( FileStream^ fs, String^ value )
{
array<Byte>^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
fs->Write( info, 0, info->Length );
}I have added
System::IO::
before
FileStream
but the compiler still returns an error regarding the UTF8Encoding... :doh:
-
ifstream & ofstream manipulators equivalents in C++/CLIifstream INPUT ("INPUT.csv");
INPUT << Cell1;
INPUT.close();ofstream OUTPUT ("OUTPUT.csv");
OUTPUT << Heading1;
OUTPUT.close();Any body could please tell me what are the C++/CLI equivalents for the INPUT / OUTPUT manipulators above? Many thanks.
-
C++/CLI -- Where to declare pre-selected list box and radio button attributes?Thanks for the advice, it works very well and the designer page is not affected. It all needs to go into the Load event. Cheers
-
C++/CLI -- Where to declare pre-selected list box and radio button attributes?listBox1->SelectedItem = "---- SELECT! ----";
listBox2->SelectedItem = "---- SELECT! ----";
radioButton1->Checked = true;
radioButton2->Checked = true;Hi guys, I need my application to start with some pre-selected items in the list boxes and radio buttons, and I can achieve this by manually pasting the code above between the lines of the code which is automatically generated by VS2008 (using Windows Forms). By doing this the program works however the GUI Design page gets really screwed up and I loose the ability to make any further editing! Where do these attributes have to be inserted? I have tried in the main{} section but it returns an error. Help please!!
-
C++/CLI Convert long Strings to Intint BigNumber = Convert::ToInt64(BigString);
I am trying to create an Int (BigNumber) from a very long String (BigString, which is made up of let's say ~25 characters). Should I use ToInt64 or ToInt32? What are the character limits of the two? What's better? Thank you!
-
C++/CLI string formattingint MyInt;
String^ MyString = MyInt.ToString();Guys, I need some help on C++/CLI please. Given an Int ("MyInt") how can I generate a string called "MyString" which is made up of only the first let's say 5 digits of the Int? I guess there must be a simple attribute that I can specify in the line above but I cannot find the right sintax. Any help would be appreciated. Many thanks.
-
C++/CLI: Formatting outputs (decimal places, hexadecimal, case notation)In reply to my question...
textBox1->Text= Variable1.ToString("N0"); //shows value with 0 decimal places
textBox1->Text= Variable1.ToString("N2"); //shows value with 2 decimal places
textBox1->Text= Variable1.ToString("X"); //shows value in Hexadecimal notation (capital case)
textBox1->Text= Variable1.ToString("x"); //shows value in Hexadecimal notation (normal case)Hope it helps somebody out there like me. I am really amazed there isn't a decent manual on these very basic things... It must all be there on MSDN but I find it the most impossible reference to consult.
-
C++/CLI: Formatting outputs (decimal places, hexadecimal, case notation)Any advice please on where to find more info on this? Thanks
-
C++/CLI: Formatting outputs (decimal places, hexadecimal, case notation)Hi, when I was programming in console mode if I needed to display only 2 decimal values of a variable (e.g. Variable1) I would write this simple code:
cout << "Variable1 = " << setprecision (2) << fixed << Variable1 << endl;
But now in C++/CLI environment how can I display this value inside a textbox showing only 2 decimal values? Can I add some attributes to the following code?
textBox1->Text= Variable1.ToString();
And what about if I wanted to display it in Hexadecimal and/or in Upper case notation? Many thanks in advance!