add datagridview

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2009
Posts: 40
Reputation: ggl0rd is an unknown quantity at this point 
Solved Threads: 1
ggl0rd ggl0rd is offline Offline
Light Poster

add datagridview

 
0
  #1
Aug 28th, 2009
this is a error when i click the button add

Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.

  1. DataGridView1.Rows.Add((txtPelan.Text), (txt36P.Text))
\
anyone can help me?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 271
Reputation: GeekByChoiCe is on a distinguished road 
Solved Threads: 56
GeekByChoiCe GeekByChoiCe is offline Offline
Posting Whiz in Training

Re: add datagridview

 
1
  #2
Aug 29th, 2009
you have to add it first to your dataset. and then you can add this row.

here is some sample code that you need to adjust a bit but it gives you the idea
  1. Dim rwNewData As DATASETRujukanRekod.RekodAnggaranRow
  2. Dim daNewdata As New DATASETRujukanRekodTableAdapters.RekodAnggaranTableAdapter
  3. rwNewData = DATASETRujukanRekod.Tables("whatTable").NewRow
  4. rwNewData.ItemArray = New Object() {"38", "bla"}
  5. DATASETRujukanRekod.Tables("whatTable").Rows.Add(rwNewData)
  6. RekodAnggaranTableAdapter.Fill(DATASETRujukanRekod.RekodAnggaran)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 311 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC