Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Save row by row data of TableLayoutPanel in sql

$
0
0

Hi all,

I have created dynamic controls like textbox, combobox in TableLayoutPanel and there are multiple rows in TableLayoutPanel.

Now i want to save one by one row data of these control into database which are generated dynamic.

From below given data i want to get first row data(Excel,OpenExcel,1 and 2) and save to database then for second row's and so on.

Excel(ComboBox)           OpenExcel (ComboBox)           1(TextBox)           2(TextBox)

Browser                          KillUrl                                        3                        4

string[] datatxt = new string[this.TableLayoutPanel1.Controls.Count];
string[] datacb = new string[3];
for (int r = 0; r < TableLayoutPanel1.RowCount; r++)
{
for (int i = 0; i < this.TableLayoutPanel1.Controls.Count; i++)
{
if (this.TableLayoutPanel1.Controls[i] is TextBox)
{
TextBox txtserial = (TextBox)this.TableLayoutPanel1.Controls[i];
string value = txtserial.Text;
datatxt[i] += value;
value = "";
}
if (this.TableLayoutPanel1.Controls[i] is ComboBox)
{
ComboBox cbserial = (ComboBox)this.TableLayoutPanel1.Controls[i];
string value = cbserial.Text;
datacb[i] += value;
value = "";
}
}

The given code is getting all rows data, but i want to one by one row data.

Please help


Neeraj Yadav


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>