|
(Next time it's your turn again)
All the best,
Martin
|
|
|
|
|
it's not the same..
comparing strings takes more resources than comparing integers (which enums are)..
life is study!!!
|
|
|
|
|
quiteSmart wrote: result.toString() == "Yes"
result.toString() == "Ok"
result.toString() == "Cancel"
You should compare the result directly with the members of the DialogResult enumeration, because it's less error-prone.
result == DialogResult.Yes
result == DialogResult.OK
result == DialogResult.Cancel
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
IT is the same man
no errors will happen
|
|
|
|
|
quiteSmart wrote: IT is the same man
no errors will happen
Sure, it will work, but what if Microsoft decides to change the return values of toString in the next framework version. Comparison with the enumeration members will still work, but your string comparison will not.
Furthermore, I wasn't refering to errors at runtime, but mainly to those made during development. If you have a typo in a string value, the code will compile fine, but it will not do what you expect it to do. If you have a typo in the identfiers of enumeration members, the compiler will complain, so the process of writing the code is less error-prone.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It seems that you convinced me. I guess your totaly right. I will start using the enumeration from now on.
Thanks anyway
|
|
|
|
|
Stefan Troschütz wrote: Sure, it will work, but what if Microsoft decides to change the return values of toString in the next framework version. Comparison with the enumeration members will still work, but your string comparison will not.
Not just then, but what about foreign language OSes. Wouldn't they have localized button names?
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
But if you have a typo somewhere in your string the compiler won't tell you about it which he would do when using enumeration values.
Robert
|
|
|
|
|
Can I change the color of perticular cell in C# for DataGrid control.
I want to change the color of the cells which have numeric value below 100.
|
|
|
|
|
foreach (GridViewRow row in GridView1.Rows)
{
long cellValue = long.Parse(row.Cells[1].Text.ToString());
if (cellValue > 100)
{
row.Cells[1].BackColor = System.Drawing.Color.Red;
row.Cells[1].ForeColor = System.Drawing.Color.Blue;
}
}
Here Cells[1] 1 should be the index of the Column that you want to compare.
for(int i=0;i<500;i++)
Console.WriteLine("I Love C# \n");
|
|
|
|
|
But I am not using any WEB page , can I use (GridViewRow control ) for the desktop application aswell.
|
|
|
|
|
I want to learn how to create custom skinned GUIs like the ones we see
when using products like StyleXP or WindowBlinds.
I've just started with basic windows forms programming, and I'm finding
the default styles to be sucky.
What are the techniques of 'skinning' a window's form? (In Visual C++ 6
and in Visual C#) Will it vary depending on languages? as in VC++6 and
VC#?
A detailed explanation would be very helpful.
Thanks.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
A good place to start could possibly be to create a UserControl , override the OnPaint method and spam some GDI+
|
|
|
|
|
Can you create a Usercontrol in .Net compiled as ocx?
I would need to add it to VC6.0 resources.
(it takes me less time to make the usercontrol in .Net then making an ocx in C++ )
thanks
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
I am a noob. But as far as I know the final output from .NET is Assembly, Merge Module (.exe, .dll, .module)
Activex have versioning problem thats why the concept of Assembly comes into view .
Am I right Geeks?
|
|
|
|
|
Lol, many thanks for the reply, I did some searching on the net.
The only thing I came up with where people in forums arguing whether or not it was possible, but I didn't find any actual answers.
I think it must be possible, but up until now, I haven't found an answer .
It is to no avail anyway, I made a quick ocx in VB6 and it doesn't get fired in the dialog anyway. (the ocx's sole purpose was to call an exe).
|
|
|
|
|
Hi,
I'm creating a tool, in which i have to pass data from one project (B)
to other project (A).
But i dont want the A's object to be created in B..
How can i achieve this..
Can i add one more project C.. that only listen and stores.
C is accessible to B to write the data.
And can be extracted whenever necessary to the A.
Please help me..
Note: A & B are separate projects.
Regards,
nas
|
|
|
|
|
Actually yesterday there was a thread that talk about the same issue.
i will give you the reference to it,
the link is this
|
|
|
|
|
Try using IPC messenger or remoting.
Or you can have an xml file and implement a file system watcher on it.
When ever you try to write into the file , file changed event can be fired and fetch your data from the xml file.
|
|
|
|
|
i have bind a data source to a datagrid..datasource contains datetime type data ,..decimal and string....
i want select datas using datatable.select method passing filterexpression..
i used
dtblViewAll.Select("[" + [column name(datetime)] + "]" + " LIKE '%" + [strValue(string)] + "%'"))
but when we do like that it gives an error...without casting the field type of sqlquery ,.are there any ways to filter data..
thanks in advance....
|
|
|
|
|
My code is,
AxMSChart20Lib.AxMSChart chart = new AxMSChart20Lib.AxMSChart();
chart.Title.Text = "My first chart";
this.Controls.Add(chart);
When i use this code, i get this exception,
"InvalidActiveXSateException was unhandled"
Exception of type:
'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.
Can u tell, how can this be corrected?
Thanks for your time and patience-Guna
|
|
|
|
|
Hi all,
I am working on Microsoft SharePoint services.
Now when i create a new site on SharePoint i have first add a entry in the DNS for this new site.
Currently i do this manually, but i want to do this through code in C#.
Are there any API's for this?
Any links or pointers in the above regard will be appreciated.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hi all,
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hello
I make a sample project that have a crystallReportViewer and a context menu
and a simple report that using an Access DB
My program work correctly But I make an installer program for it.
When Running this (installer)program on another machine( that have/not have VS and crystallReport ) show bellow error
cabinet file '_7c4f0ff510d579da233b321904df6a1c' that requared for install
not found
please help me to correct this error
thanks for you
|
|
|
|
|
how can i get text for particular element .
i.e for example: its an xml file i jus couldnt put greter then or smaller arrow key so i put braces
(testnode)
(element1)Element1 Text(/element1)
(element2)Element2 Text(/element2)
(element3)Element3 Text(/element3)
(element4)Element4 Text(/element4)
(element5)Element5 Text(/element5)
(/testnode)
i want to know for element1 the text is element1 text from xml textreader class.
feeling sad today
|
|
|
|