Sign in to follow this  
jor1980

c# link binding navigator with array

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this