|
|
Thx guys - I will rethink the whole issue and will consider your comments while then.
Cheers
|
|
|
|
|
Hi,
I have a small question. I have some variables with almost the same name. For example:
<br />
string message_108 = "fngfh";<br />
string message_109 = "88";<br />
string message_110 = "22";<br />
.....<br />
string message_200 = "ffb";<br />
All I want is to create some kind of method which receives the number of the message (e.g. 110) and that returns the description(value) of that message (message_110).
Can you give me any suggestions.
Do your best to be the best
|
|
|
|
|
Well, this sounds like a homework question. Why would anybody else want to use variable names like that? If you really wanted to use *indexed* versions of the variable, you would use an array of some description.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Actually it's not a homework, and I've tried with arrays and arraylists but I need another way that this could be done.
Do your best to be the best
|
|
|
|
|
karkster wrote: I've tried with arrays and arraylists but I need another way that this could be done
Then we need to look at the bigger picture, because at the moment what you are doing does not make any sense.
|
|
|
|
|
Let me put it in another form. I want to access a Property of a class, but I have the name of the property in a string.
Do your best to be the best
|
|
|
|
|
Use reflection. There are numerous examples on Google on how to do this. Hint - look at GetType().GetProperty(...).GetValue(...)
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Have you thought of using reflection? Reflection won't work with local variables, but will work with properties.
|
|
|
|
|
Thanks. It works with Reflection.
Do your best to be the best
|
|
|
|
|
Rework it into an array or hashtable.
|
|
|
|
|
Use reflection. Because you are using members you will have to use FieldInfo not PropertyInfo.
Of course, like others have mentioned, I would use a hash instead of members.
File Not Found
|
|
|
|
|
Hello everybody.
In my C# project I have a dataGridView with 12 Columns and 16 Rows.
Propertie ColumnHeadersVisible is set true;
How to enter value(text) into Cell between Row headers and Column headers (Cell in Topleft corner) in my dataGridView?
Thanks in advance.
|
|
|
|
|
I only found how to do it via code, not in a visual way, but it does the trick:
dataGridView1.TopLeftHeaderCell.Value = "SomeTextHere";
Hope this helped!
|
|
|
|
|
|
My first solution! I am great. Do I get a prize now?
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
To enter value in the first cell of the first row:
dataGridview.Rows[0].Cells[0].Value = "ABC";
Regards
joonyo's solution is correct. Sorry! I didn't pay attention to the details.
-- modified at 7:57 Monday 19th March, 2007
________________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
hi,
I am having a datagrid with 4 columns and one of the column type is combobox.
I am adding items to that combobox column i am able to add it.
now i want to display the first item in the combobox by default.
Now i am selecting it ,manually
help me pls
With Regards
prasad
|
|
|
|
|
Hi
Set comboObject.SelectedIndex = 0;
0 -> if first item in the list to be displayed by default
1 -> second item ....
Harini
|
|
|
|
|
hi,harini
I am getting in normal combobox property like selectedindex.
But i am using a datagridview in that one my colummn is made as combobox
help me
|
|
|
|
|
Hi
Post your code where you have added values in combo list.
Are you adding values during run time or using code behind file?
if Design time, then you can give selected=true ...
Harini
|
|
|
|
|
hi,this is adding the all clumns but i want to add single row itself.
I am getting error if i add rows saying that value doesn't match for datagridcombox column that is second column.
OpenFileDialog ObjOpenFileDialog = new OpenFileDialog();
ObjOpenFileDialog.DefaultExt = "*.cs";
ObjOpenFileDialog.Filter = "CSharp Script Files |*.cs";
if (ObjOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && ObjOpenFileDialog.FileNames.Length > 0)
{
Column3.Items.Add(ObjOpenFileDialog.FileName);
//scriptDGView.Rows.Add(true, ObjOpenFileDialog.FileName, "", "");
}
ObjOpenFileDialog.Dispose();
help me pls
|
|
|
|
|
i want to know ip adresses of all the systems which are active on my LAN.......DNS. gives me ip address of local machine but i want to know the ip address of all the connected systems
|
|
|
|