Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > A data Grid with results depending on User Input
 

A data Grid with results depending on User Input

Hey

I am getting the Hang of this now

I am using C#, building a Windows Form

What I would like to do is have a txtbox, where someone types in something, then the results will show (A datagrid will do), then they can click on a button, and it will add that number in another txtfield on another Dialog box.

Its a Product Code finder, if they dont know the code of the product, they will open the dialog box, and search by product name

How would I go about doing this?
onlyican  Tuesday, June 27, 2006 1:14 PM
I have done the following

SqlConnection conn = new SqlConnection(@"MyConnectionHere");

SqlCommand cmd = new SqlCommand("Select * FROM tbl1 WHERE Nombre LIKE '%"+txtSearch.Text+"%'", conn);

DataSet ds = new DataSet("MyDataSet");

conn.Open();

SqlDataReader rdr = cmd.ExecuteReader();

if(rdr.Read() == true){

MessageBox.Show("Here I will add the results into the DataGrid", "Next Step", MessageBoxButtons.OK);

}else{
MessageBox.Show("I am afraid there are no products where where the product name is like\n"+txtSearch.Text+"\nPlease try again, maybe use less letters","No Results Found",MessageBoxButtons.OK,MessageBoxIcon.Error);
txtSearch.Focus();


}



How do I get them results into the DataGridView
onlyican  Tuesday, June 27, 2006 1:37 PM
Anybody out there who can help
onlyican  Tuesday, June 27, 2006 6:39 PM

You can use google to search for other answers

Custom Search

More Threads

• TextBox binding and format
• Click Delete button on dataBindingNavigator
• Keeping same cell address selected after sorting unbound DataGridView
• Auto commit in sql server off
• DataGridViewCell bounds
• [ Resolved! ] Filling a ListView from a DataReader problem?
• Typed Dataset problem
• How to display a mdi child form from a mdichild?
• event on record change
• datagrid and datetime value