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

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

Post by mjpiedad » Fri, 20 Feb 2004 09:10:25


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.

Thank you in advance for any help.
Best regards,
Miguel Piedade
 
 
 

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

Post by William Ry » Fri, 20 Feb 2004 09:28:11

Are you using a BindingContext? If so, just set its .Position property +1
or -1 or whatever increment you want it to move to.


it.

 
 
 

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

Post by mjpiedad » Fri, 20 Feb 2004 17:52:09

William

And what if I want to move to a position in a datatable that I do not know
its index. Example:
I have an textbox with the name of a customer, and when the user types a
name on it, I want to move to the first order for that user in my dataset?
How can I manage these situations?

Thank you in advance,

Miguel Piedade





other
textbox
 
 
 

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

Post by bWpwaWVkYW » Sat, 21 Feb 2004 05:31:07

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
 
 
 

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

Post by mohamed.mo » Sat, 21 Feb 2004 21:46:40


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
 
 
 

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

Post by R2Fye » Sun, 22 Feb 2004 03:26:05

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.