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
Naeem Khan
974
802
799.8k
Text Box event for Barcode Scanner using Windows Application
Aug 5 2015 1:52 AM
Hello friends,
I m using code for barcode saccning . i m reteriving data from database when text box fill by accession no but i dont have any idea which event should i used for it.. if do you have any idea then plz reply me ASAP..
private void stock_verification()
{
Boolean found = false;
foreach (DataGridViewRow row in gv_show_details.Rows)
{
if (row.Cells[0].Value.ToString() == txt_accession_no.Text)
{
found = true;
MessageBox.Show("Book already exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
txt_accession_no.Text = "";
txt_accession_no.Focus();
break;
}
}
if (!found)
{
try
{
MySqlConnection con = new MySqlConnection(StartUp.database);
con.Open();
MySqlCommand cmd = new MySqlCommand("call ps_stock_verification_books('" + txt_accession_no.Text + "')", con);
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
gv_show_details.Rows.Add();
gv_show_details.Rows[i].Cells[0].Value = dr[0].ToString();
gv_show_details.Rows[i].Cells[1].Value = dr[1].ToString();
gv_show_details.Rows[i].Cells[2].Value = dr[2].ToString();
gv_show_details.Rows[i].Cells[3].Value = dr[3].ToString();
gv_show_details.Rows[i].Cells[4].Value = dr[4].ToString();
gv_show_details.Rows[i].Cells[5].Value = dr[5].ToString();
gv_show_details.Rows[i].Cells[6].Value = dr[6].ToString();
i++;
}
lbl_number_of_bboks.Text = "Number of Books : " + gv_show_details.RowCount;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void txt_accession_no_Validating(object sender, CancelEventArgs e)
{
stock_verification();
txt_accession_no.Focus();
txt_accession_no.Text = "";
}
Reply
Answers (
1
)
How to use seagate crysal report in visual studio 2010?
Grouping excelsheet in c#