i need code for get selected column value from datagridview into array list //foreach (DataGridViewRow row in this.dataGridView1.Rows) //{ // if ((((bool)(row.Cells[this.invoiceNO.Index].Value)) == true)) // { // a.Add(row.Cells[this.invoiceNO.Index].Value); // } //}
Member 12899746
Posts
-
I can not understand the error.....code bellow...for trans data from sql database to another -
I can not understand the error.....code bellow...for trans data from sql database to anotheri get my issue.... i need to get the value from DataGridView that was selected into array. can you write to me example code.
-
I can not understand the error.....code bellow...for trans data from sql database to anothermany thanks for your advice and your time.
-
I can not understand the error.....code bellow...for trans data from sql database to anotherno i'm not clinically insane.... but we are in a community to help each author.and i'm stacked.
-
I can not understand the error.....code bellow...for trans data from sql database to anotherdid you have a time to take a look via teamviewr
-
I can not understand the error.....code bellow...for trans data from sql database to anotherthis is debugger error(Specified cast is not valid.)
-
I can not understand the error.....code bellow...for trans data from sql database to anotherSpecified cast is not valid.
-
I can not understand the error.....code bellow...for trans data from sql database to anotherprivate void exprtbtn_Click(object sender, EventArgs e)
{
try
{
if ((this.dataGridView1.Rows.Count == 0))
{
MessageBox.Show("Please select Vouchers");
}
else
{
// HEaders Vouchers
SqlConnection con = null;
SqlConnection con2 = null;
connClass cs = new connClass();
con = new SqlConnection(cs.distiConn1);
con2 = new SqlConnection(cs.sourceConn2);ArrayList a = new ArrayList(); DataTable DT = new DataTable(); SqlCommand cmd = new SqlCommand(); SqlTransaction trans = default(SqlTransaction); con.Open(); trans = con.BeginTransaction(); cmd.Connection = con; cmd.Transaction = trans; SqlCommand cmdLive = new SqlCommand(); cmdLive.Connection = con2; SqlDataAdapter DR = default(SqlDataAdapter); //foreach (DataGridViewRow row in dataGridView1.Rows) //{ // if ((bool) row.Cells\[this.invoiceNO.Index\].Value == true) // { // a.Add(row.Cells\[this.invoiceNO.Index\].Value); // } //} //foreach (DataGridViewRow row in this.dataGridView1.Rows) //{ // if ((bool)row.Cells\[this.invoiceNO.Index\].Value == true) // { // a.Add(row.Cells\[this.invoiceNO.Index\].Value); // } //} error in the anderline code foreach (DataGridViewRow row in this.dataGridView1.Rows) { if ((((bool)(row.Cells\[this.invoiceNO.Index\].Value)) == true)) { a.Add(row.Cells\[this.invoiceNO.Index\].Value); } } int C = a.Count; string str = "("; int i = 0; while (i < C - 1) { str += "'" + a\[i\] + "',";
-
Specified cast is not valid. i can't understand erroryes i'm its int
-
Specified cast is not valid. i can't understand errorforeach (int VouType in DR)
-
Specified cast is not valid. i can't understand errorpublic void FillCompVouType()
{
try
{
this.Cursor = Cursors.WaitCursor;
con = new SqlConnection(cs.sourceConn1);
con.Open();
scmd = new SqlCommand("Select Distinct VouType From Table_name Where Colum=1 order by VouType", con);
SqlDataReader DR = default(SqlDataReader);vochcombox.Items.Clear(); DR = scmd.ExecuteReader(); foreach (int VouType in DR) { vochcombox.Items.Add(VouType); } while (DR.Read()) { this.vochcombox.Items.Add(DR.GetOrdinal("VouType")); } DR.Close(); con.Close(); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (con.State == ConnectionState.Open) { con.Close(); } } }
-
i get an error (non-invocable member-- can't be used like a method) any help?it's work......... manythanks
-
i get an error (non-invocable member-- can't be used like a method) any help?many thanks...but i get another error (Operator '==' cannot be applied to operands of type 'object' and 'bool')
-
i get an error (non-invocable member-- can't be used like a method) any help?foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
if (row.Cells(this.invoiceNO.Index).Value == true)
{
a.Add(row.Cells(this.invoiceNO.Index).Value);
}
}