how to navigate in a dataset changing the text on a databound texbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just started with C#.
How do I navigate on a dataset by changing the value of a textbox or other
simple bound controls? Imagine that I have the customer name on a textbox
and have a datagrid with the orders that will display the orders of the
customer that the user enters on the textbox.
With combobox or lisbox the binding is automatically defined, but with
controls with simple bound I just can not figure it out a easy way to do it
Actually, what I want to do is a select on the dataset, depending on the information the user puts on textbox.text

Thank you in advance for any help.
Best regards,
Miguel Piedade
 
Hi Meguel
There I tow method I can think about that helps you navigate A Table inside
a DataSet
First there is the find method
**The find method is a method of The DataTabel object , it returns a
row of data . To use the Find method you have to define the primary key
property of the data table and you have to be looking for a primary key
value
For example if you set the primary key property of table
named employee to the ID columns { employee.Primarykey = new DataRow[]
{ID}// it takes an array of datarows , even if the array contains one value}
Then you can get the row of the employee that has an id equal to 500 this
way
DataRow result =Employee.Rows.Find("500");
** the other method is select which is also a method of the DataTable
object . you give as Argument to the select method an SQL statement an it
return an array of refernce to the data rows that matches as follows
DataRow[] result = employee.Select("ID= 500");

Hope that would help
 
You can also try
this.BindingContext[DataSetControl, "Table Name Here"].Position++ to navigate to the next record
o
this.BindingContext[DataSetControl, "Table Name Here"].Position-- to go prior.
 
Back
Top