0

Using VB.Net

Am new to vb.net, Am using datagridview

DataGridview

ID Name ComboboxColumn 001 Raja 002 Ravi 003 Suresh ..., 

"Save" - Button

In a Datagridview am Using combobox column in a third column

Suppose If i select the value from the combobox, then i Press the save button means, The Datagridview column value should save in the table.

If am not selected the value in the combobox, the ID and Name should not save in the table.

How to make a query or code for this condition?

Need vb.net code Help

2 Answers 2

1

loop through the rows of the GridView

for(int i=0; i<= GridView1.Rows.Count-1; i++) { string comboValue = ((DropdownList)GridView1.Rows[i].FindControl("Dropdownlist1")).SelectedValue; if(comboValue == "Yes") { //Save to database. Alternatively, you can load it in your business entity object and loop through the object collection and save it to the database individually. } } 
Sign up to request clarification or add additional context in comments.

3 Comments

Use one of the many C#-to-VB.NET converters online, e.g. developerfusion.com/tools/convert/csharp-to-vb
The question seems to be about winforms DataGridView not asp.net's GridView.
see this...you will get some help from here --> codeproject.com/KB/webforms/GridViewInsideGridView.aspx (but this is c#). You can translate it.
1

http://quickstarts.asp.net/QuickStartV20/aspnet/

here are lot of samples in VB as well in C#

1 Comment

DataGridView is a winforms control

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.