locked
how to access column in datarow object RRS feed

  • Question

  • User507956310 posted

    Hello,

    I access the datable and loop through it...ok that works.

    but how do I get whatever is in column WText as text in the textbox?

     

        Dim tPAttribute As New Mask_ALL_InputIsIDTableAdapter()
        Dim i As Integer = 1
            Dim dt As Mask_ALL_InputIsIDDataTable
            'Dim dr As Mask_ALL_InputIsIDRow
            dt = tPAttribute.GetAllMASK(GridViewAll.SelectedRow.Cells(1).Text)
            'dr = DirectCast(dt.Rows(0), Mask_ALL_InputIsIDRow)
    
            'Loop through dataset and for every row and add to placeholder:
    
            For Each row In dt.Rows
                Dim TextBoxW As New TextBox
                'TextBoxW.ID=i
                WPlaceHolder.Controls.Add(TextBoxW)
                TextBoxW.Text = '...... should be dr.column("WText").ToString
                i = i + 1
            Next
     

    There is no error, its just that my textbox is empty.

    many thanks for any help.


    Sunday, October 26, 2008 8:28 AM

All replies

  • User507956310 posted

     just tried TextBoxWxx.Text = row("Wxxx").ToString  'and that worked

    Sunday, October 26, 2008 9:22 AM
  • User-1637698612 posted

    Hello,

    I access the datable and loop through it...ok that works.

    but how do I get whatever is in column WText as text in the textbox?

     

        Dim tPAttribute As New Mask_ALL_InputIsIDTableAdapter()
        Dim i As Integer = 1
            Dim dt As Mask_ALL_InputIsIDDataTable
            'Dim dr As Mask_ALL_InputIsIDRow
            dt = tPAttribute.GetAllMASK(GridViewAll.SelectedRow.Cells(1).Text)
            'dr = DirectCast(dt.Rows(0), Mask_ALL_InputIsIDRow)
    
            'Loop through dataset and for every row and add to placeholder:
    
            For Each row In dt.Rows
                Dim TextBoxW As New TextBox
                'TextBoxW.ID=i
                WPlaceHolder.Controls.Add(TextBoxW)
                TextBoxW.Text = '...... should be dr.column("WText").ToString
                i = i + 1
            Next
     

    There is no error, its just that my textbox is empty.

    many thanks for any help.


    Perhaps modify the ForEach statement to:

    ForEach DataRow row in dt.Rows

    then:

    TextBoxW.Text = row.Columns["WText"] .ToString

    I'm not really familiar with VB syntax, but that's how I would translate from C# syntax

    Sunday, October 26, 2008 9:29 AM