TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
libertychisasuro
NA
11
0
Minor adjustment needed!
Apr 2 2005 7:40 PM
i got this piece of code i need someone to do a minor modification for me. Its from searching a datagrid and i need a message box to appear when the record is not found: private void btnSearch_Click(object sender, System.EventArgs e) { // Verify that the user typed test to search for. if(txtSearch.Text == "") { MessageBox.Show("Enter some criteria to find."); txtSearch.Focus(); } else { // Create a SqlCommand OleDbCommand oleDbSelectCommand1 = oleDbConnection1.CreateCommand(); oleDbSelectCommand1.CommandType = CommandType.Text; oleDbSelectCommand1.CommandText = "SELECT * FROM Students"; // Use the Select method to get a **sorted** array of DataRows { DataRow[] adr = ds.Tables["Students"].Select( "FirstName = '" + txtSearch.Text + "'",""); // Dump the result to the user interface lbStudents.Items.Clear(); foreach(DataRow dr in adr) { //******************FORMATTING LISTBOX*********** //////////////////////////////////////////////// //////////////////////////////////////////////// lbStudents.Items.Add(""); lbStudents.Items.Add("Student ID : " + dr[5]); lbStudents.Items.Add("First Name : " + dr[3]); lbStudents.Items.Add("Last Name : " + dr[1]); lbStudents.Items.Add("Address : " + dr[0]); lbStudents.Items.Add("Phone : " + dr[4]); lbStudents.Items.Add("GPA : " + dr[2]); lbStudents.Items.Add(""); //////////////////////////////////////////////// //////////////////////////////////////////////// //////////////////////////////////////////////// } } thnx
Reply
Answers (
1
)
Microsoft Acces and Datagrid
Require C++ Sweep Test code converted to C#?