Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. textboxes to datagrid

textboxes to datagrid

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Makniteasy
    wrote on last edited by
    #1

    I have 5 textboxes. I also have a datagrid. the datagrid has 5 columns.ItemID,CheckNo,Payee,Amount,Date. I need textbox1 to go to ItemID(column1,row1) I need textbox2 to go to CheckNo.(column2,row1) Textbox3 to payee(column3,row1) textbox4 to amount(column4,row1) textbox5 to date(column5,row1) I need these to do so on a button click and I already know that the code must be placed in the Private Sub Button1_Click part. How do I get these textboxes to do so?

    R 1 Reply Last reply
    0
    • M Makniteasy

      I have 5 textboxes. I also have a datagrid. the datagrid has 5 columns.ItemID,CheckNo,Payee,Amount,Date. I need textbox1 to go to ItemID(column1,row1) I need textbox2 to go to CheckNo.(column2,row1) Textbox3 to payee(column3,row1) textbox4 to amount(column4,row1) textbox5 to date(column5,row1) I need these to do so on a button click and I already know that the code must be placed in the Private Sub Button1_Click part. How do I get these textboxes to do so?

      R Offline
      R Offline
      Ritesh1234
      wrote on last edited by
      #2

      Hi, I assume your Grid'd Datasource is dtGrid (Datatable) in that case in Button_Click Event u can Create a New Datarow of dtGrid dim drNew as Datarow drNew = drGrid.NewRow than just pass on the Values of TextBoxes........as drNew.Item("ItemID") = txtItem.text...... .............. after that just add this Row to ur Table as dtGrid.Rows.add(drNew) dgGrid.Refresh...... I hope this is what u want..... Regards, Ritesh

      M 1 Reply Last reply
      0
      • R Ritesh1234

        Hi, I assume your Grid'd Datasource is dtGrid (Datatable) in that case in Button_Click Event u can Create a New Datarow of dtGrid dim drNew as Datarow drNew = drGrid.NewRow than just pass on the Values of TextBoxes........as drNew.Item("ItemID") = txtItem.text...... .............. after that just add this Row to ur Table as dtGrid.Rows.add(drNew) dgGrid.Refresh...... I hope this is what u want..... Regards, Ritesh

        M Offline
        M Offline
        Makniteasy
        wrote on last edited by
        #3

        Hey It Seems to be ok but the part that says drNew = drGrid.NewRow it says NewRow is not declared. am I supposed to replace this with something.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups