I’m a VB guy learning C#. I seem to be getting the hang of it but I’ve got a couple questions regarding some code I’m writing.
In the first one here I’m getting an error when I write my code like so:
Irowindex = sF1411BindingSource.Find(sF1411DataSet.SF1411.Columns(groupBox4.Tag.ToString).ToString, textBox1.Text);
if (Irowindex == -1)
Error 1 ‘System.Data.DataTable.Columns’ is a ‘property’ but is used like a ‘method’ C:\11180_APPLICATION\11180_APPLICATION\Edit.cs 186 71 11180_APPLICATION
My other issue is that in VB I use Tags but in C# it doesnt seem to like them:
//Set the find label to display the new find column
groupBox4.Text = "Find - " + sender.Tag.ToString + ":";
//Store the sort column name in lblFind's Tag property
groupBox4.Tag = sender.Tag.ToString;
Error 4 ‘object’ does not contain a definition for ‘Tag’ C:\11180_APPLICATION\11180_APPLICATION\Edit.cs 211 36 11180_APPLICATION
Any ideas here?
Try
Columns[groupBox4.Tag.ToString()]for the first error.Regarding tags, in C# the sender is of type Object, and it doesn’t have a tag property. Try casting it to Control first: