Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The following code sends the textbox.text from a userform to a datagidview

VB
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

       Dim I As Integer

       I = Form2.ItemsDataGridView.CurrentRow.Index

       Form2.ItemsDataGridView(0, I).Value = Me.TextBox1.Text

   End Sub



but i get the error:
Object reference not set to an instance of an object
NullReference Exception was Unhandled

Please Help
Posted
Comments
PIEBALDconsult 24-Jul-14 19:41pm    
The debugger is more likely to help you.

1 solution

Your data grid probably has no columns. Therefore
VB
Form2.ItemsDataGridView(0, I)
does not exist
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900