Click here to Skip to main content
       

Visual Basic

 
AnswerRe: Controlling Monitor brightness from VB6 PinmemberSimon_Whale20-Nov-12 0:12 
QuestionExport Data from Gridview to Sql Server PinmemberNaga Raju Vutla18-Nov-12 18:22 
AnswerRe: Export Data from Gridview to Sql Server PinmemberEddy Vluggen19-Nov-12 0:01 
AnswerRe: Export Data from Gridview to Sql Server PinmemberBert Mitton19-Nov-12 8:21 
GeneralRe: Export Data from Gridview to Sql Server PinmemberEddy Vluggen19-Nov-12 9:48 
QuestionReading Complex Type from WSDL Pinmemberasv17-Nov-12 14:47 
AnswerRe: Reading Complex Type from WSDL PinmemberZac Greve17-Nov-12 16:56 
GeneralRe: Reading Complex Type from WSDL Pinmemberasv17-Nov-12 18:35 
QuestionSQL functions in VB PinmemberNaseerKhanPattan17-Nov-12 6:28 
AnswerRe: SQL functions in VB PinmemberEddy Vluggen17-Nov-12 9:36 
QuestionFinding a Row in a Datatable and putting the row to variables PinmemberJRHibner14-Nov-12 18:37 
AnswerRe: Finding a Row in a Datatable and putting the row to variables PinmemberAndy_L_J15-Nov-12 19:48 
GeneralRe: Finding a Row in a Datatable and putting the row to variables [modified] PinmemberJRHibner18-Nov-12 16:15 
AnswerRe: Finding a Row in a Datatable and putting the row to variables PinmemberAndy_L_J18-Nov-12 20:45 
Try this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Dim dt As New DataTable
  With dt
    .Columns.Add("Name")
    .Columns.Add("Address")
    .Columns.Add("Salary")
    .Rows.Add(New Object() {"John", "123 Some Street", 1234})
    .Rows.Add(New Object() {"Frank", "15 TheOther Street", 1400})
    .Rows.Add(New Object() {"Harry", "3 No Street", 450})
  End With
 
  Dim dr As DataRow = GetDataRow(dt, "John")
  Label1.Text = String.Format("Name = {0}{3}Address = {1}{3}Salary = {2}",
				 dr("Name").ToString, dr("Address").ToString, dr("Salary").ToString, vbCrLf)
End Sub
 
Private Function GetDataRow(ByVal dt As DataTable, ByVal name As String) As DataRow
  Dim sStringTemp2 = "Name = '" + name + "'"
  Dim tRow As DataRow() = dt.Select(sStringTemp2)
  Return tRow(0)
End Function
Note that your tRow object is an Array; Dim tRow as DataRow(), so we returned the first result, you may need to iterate through the array if there ismore than one result returned from the Select method.
 
Hope this helps. Big Grin | :-D
I don't speak Idiot - please talk slowly and clearly
 
"I have sexdaily. I mean dyslexia. Fcuk!"
 
Driven to the arms of Heineken by the wife

GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberJRHibner18-Nov-12 20:55 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberAndy_L_J18-Nov-12 21:33 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberJRHibner18-Nov-12 21:36 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberJRHibner27-Nov-12 19:28 
AnswerRe: Finding a Row in a Datatable and putting the row to variables PinmemberAndy_L_J27-Nov-12 20:56 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberJRHibner27-Nov-12 23:40 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberAndy_L_J28-Nov-12 0:20 
GeneralRe: Finding a Row in a Datatable and putting the row to variables PinmemberJRHibner28-Nov-12 10:35 
QuestionChanging Assembly Properties through Reflection PinmemberDisIsHoody14-Nov-12 9:38 
AnswerRe: Changing Assembly Properties through Reflection PinmemberEddy Vluggen15-Nov-12 1:18 
GeneralRe: Changing Assembly Properties through Reflection PinmemberDisIsHoody15-Nov-12 17:14 
GeneralRe: Changing Assembly Properties through Reflection PinmemberEddy Vluggen16-Nov-12 0:06 
Questionmessagebeep PinmemberGil Goodridge14-Nov-12 8:00 
AnswerRe: messagebeep PinmvpDave Kreskowiak14-Nov-12 8:31 
QuestionRijndael encryption not working Pinmembermaskrtnik0114-Nov-12 2:20 
AnswerRe: Rijndael encryption not working PinmentorKeith Barrow14-Nov-12 2:52 
GeneralRe: Rijndael encryption not working Pinmembermaskrtnik0114-Nov-12 3:08 
GeneralRe: Rijndael encryption not working PinmentorKeith Barrow14-Nov-12 3:26 
GeneralRe: Rijndael encryption not working PinmentorKeith Barrow14-Nov-12 3:35 
GeneralRe: Rijndael encryption not working Pinmembermaskrtnik0114-Nov-12 3:48 
GeneralRe: Rijndael encryption not working PinmentorKeith Barrow14-Nov-12 4:05 
QuestionRe: Rijndael encryption not working [modified] Pinmembermaskrtnik0115-Nov-12 19:40 
GeneralRe: Rijndael encryption not working PinmemberDisIsHoody14-Nov-12 9:34 
GeneralRe: Rijndael encryption not working Pinmembermaskrtnik0114-Nov-12 18:21 
AnswerRe: Rijndael encryption not working PinmemberDisIsHoody15-Nov-12 17:37 
GeneralRe: Rijndael encryption not working Pinmembermaskrtnik0115-Nov-12 19:37 
QuestionRetrive date from sql server in system date format in VB6 application by a one time setting PinmemberJohnson Antony13-Nov-12 13:34 
AnswerRe: Retrive date from sql server in system date format in VB6 application by a one time setting PinmvpDave Kreskowiak13-Nov-12 14:00 
QuestionHow to find out if a file is in use before reading the data in that file PinmemberKreativeKai13-Nov-12 7:47 
AnswerRe: How to find out if a file is in use before reading the data in that file PinmvpDave Kreskowiak13-Nov-12 8:09 
GeneralRe: How to find out if a file is in use before reading the data in that file PinmemberKreativeKai13-Nov-12 8:22 
GeneralRe: How to find out if a file is in use before reading the data in that file PinmemberKreativeKai13-Nov-12 8:46 
AnswerRe: How to find out if a file is in use before reading the data in that file PinmemberKreativeKai13-Nov-12 8:13 
GeneralRe: How to find out if a file is in use before reading the data in that file [modified] PinmvpDave Kreskowiak13-Nov-12 9:57 
AnswerRe: How to find out if a file is in use before reading the data in that file PinmemberEddy Vluggen13-Nov-12 11:41 
GeneralRe: How to find out if a file is in use before reading the data in that file PinmemberKreativeKai14-Nov-12 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 18 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid