VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] strSQL [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "select inventItem.id as 'id', inventItem.name as 'name', inventItem.description as 'desc', restock.qty as 'qty', inventItem.priceQuantity as 'price', restock.qty*inventItem.priceQuantity as 'total' from inventItem inner join restock on inventItem.id = restock.item where restock.po = " & poId
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strConn [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = General.strConn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] itemDS [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet
[/size][size=2][color=#008000]'Dim itemView As DataView
[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] itemAdapter [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlDataAdapter
itemAdapter = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlDataAdapter(strSQL, strConn)
itemDS = [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataSet
itemAdapter.Fill(itemDS)
[/size][size=2][color=#008000]'itemView = New DataView(itemDS.Tables(0))
[/color][/size][size=2]dgItem.SetDataBinding(itemDS, "Table")
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] itemTableStyle [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTableStyle
itemTableStyle.MappingName = "Table"
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol1 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol2 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol3 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol4 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol5 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] aCol6 [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataGridTextBoxColumn
aCol1.MappingName = "id"
aCol1.HeaderText = "ID"
aCol1.Width = 35
aCol1.Alignment = HorizontalAlignment.Center
aCol2.MappingName = "name"
aCol2.HeaderText = "Item"
aCol2.Width = 180
aCol3.MappingName = "desc"
aCol3.HeaderText = "Description"
aCol3.Width = 250
aCol3.Alignment = HorizontalAlignment.Center
aCol4.MappingName = "qty"
aCol4.HeaderText = "Quantity"
aCol4.Width = 90
aCol4.Alignment = HorizontalAlignment.Center
aCol5.MappingName = "price"
aCol5.HeaderText = "Price/Unit($)"
aCol5.Width = 90
aCol5.Alignment = HorizontalAlignment.Right
aCol5.Format = "#0.00"
aCol6.MappingName = "total"
aCol6.HeaderText = "Sub-Total($)"
aCol6.Width = 90
aCol6.Alignment = HorizontalAlignment.Right
aCol6.Format = "#0.00"
[/size][size=2][color=#0000ff]With[/color][/size][size=2] itemTableStyle.GridColumnStyles
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
.Add(aCol4)
.Add(aCol5)
.Add(aCol6)
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]With
[/color][/size][size=2]dgItem.TableStyles.Add(itemTableStyle)
[/size]
the codes show aboves is my datagrid declaration.
i want to know how to call a function when i click on one of the cell in my datagrid.
wat i want to do it to select a row from the datagrid. then when i click a button, it'll send the value of the first column to a function. how can i do this?