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
Marvin Gapuz
NA
85
6.1k
Display data to datagridview
Mar 25 2019 8:38 AM
private void CmbCombo_SelectedValueChanged(object sender, EventArgs e)
{
try
{
if (CmbCombo.SelectedValue != null && CmbCombo.SelectedIndex != -1)
{
if (CmbCombo.SelectedValue.ToString() != string.Empty && CmbCombo.SelectedValue.ToString() != "System.Data.DataRowView")
{
ComboCreationSP creationSP = new ComboCreationSP();
ComboCreationInfo creationInfo = new ComboCreationInfo();
creationInfo = creationSP.ComboMasterViewAllForProduct(Convert.ToDecimal(CmbCombo.SelectedValue));
for (int a = 0; a < 2; a++)
{
dgvSalesInvoice.Rows.Add();
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceProductName"].Value = creationInfo.ProductName;
dgvSalesInvoice.Rows[a].Cells["DcDescription"].Value = creationInfo.ProductName;
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceBrand"].Value = creationInfo.PBrandId;
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceQty"].Value = creationInfo.Qty;
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceRate"].Value = creationInfo.Rate;
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceProductCode"].Value = creationInfo.ProductCode;
dgvSalesInvoice.Rows[a].Cells["dgvtxtSalesInvoiceBarcode"].Value = creationInfo.Barcode;
}
txtTotalAmount.Text =Convert.ToString(creationInfo.Amount);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Please help, I use this code to display the data from the database to the datagridview, the problem is that it only displays the last data.
Reply
Answers (
3
)
hex to ascii conversion
How to make custom info window in xamarin forms maps?