Jump to content
  • Advertisement
Sign in to follow this  
jor1980

c# link binding navigator with array

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!