Skip to main content
gamedev.net
🔒 Locked

c# link binding navigator with array

Started by jor1980 2 replies 1.9k views
Original Post
jor1980
jor1980
HI, i have an array of a class created by me:
 public class SubFileINfo    {       public string Name;       public UInt32 StartOffset;       public UInt32 Length;    }


then i have created this array:
SubFileINfo[] info = Array.FindAll(FifaTextureEditor.Form1.SubfileArray,inf =>inf.Name.Contains(textBoxBuscar.Text));

and i want to link the member name to the binding navigator to preview the name member of each element into a textbox
jor1980
jor1980
Quote:
Original post by jor1980
HI, i have an array of a class created by me:
 public class SubFileINfo    {       public string Name;       public UInt32 StartOffset;       public UInt32 Length;    }


then i have created this array:
SubFileINfo[] info = Array.FindAll(FifaTextureEditor.Form1.SubfileArray,inf =>inf.Name.Contains(textBoxBuscar.Text));

and i want to link the member name to the binding navigator to preview the name member of each element into a textbox


Now i have created a bindingsource and a bindingnavigator:
 bindingSource1.DataSource = info;                 bindingNavigator1.BindingSource = bindingSource1;


Now i see that he navigator seems to work but i need to display the member Name of the class SubFileInfo created by me, and i don´t now how to do it,i have tried this:

 textBoxResultado.DataBindings.Add(new Binding("Text",bindingSource1,"Name"));

but it sends the error; it can links with the property Name or column in the datasource. Name of the parameter: DataMember
Zipster
Zipster
I would try extracting an array of the Name members directly and using that as the data source instead. Off the top of my head:

string[] infoNames = from info in FifaTextureEditor.Form1.SubfileArray where info.Name.Contains(textBoxBuscar.Text) select info.Name
jor1980
jor1980
Quote:
Original post by Zipster
I would try extracting an array of the Name members directly and using that as the data source instead. Off the top of my head:

string[] infoNames = from info in FifaTextureEditor.Form1.SubfileArray where info.Name.Contains(textBoxBuscar.Text) select info.Name

I will need a two dimensions array because i need the info of the position of each subfile, Do you think that it is possible to do what you say but creating a two dimensions string array with the name and the position, in both cases i don´t know how must change this sentence to make it work:

textBoxResultado.DataBindings.Add(new Binding("Text",bindingSource1,"Name"));

because Name must refer to a field of a datatable and i am passing an array of strings

but first of all when i wrote what you said me:
info = Array.FindAll(FifaTextureEditor.Form1.SubfileArray, inf =>inf.Name.Contains(textBoxBuscar.Text));                 string[] infoNames = from info in FifaTextureEditor.Form1.SubfileArray where info.Name.Contains(textBoxBuscar.Text) select info.Name


It says me that the range info enters in conflict with the declaration info

[Edited by - jor1980 on October 1, 2010 5:10:43 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.