Click here to Skip to main content
16,006,845 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Notepad problem Pin
Dave Kreskowiak10-Mar-05 10:33
mveDave Kreskowiak10-Mar-05 10:33 
QuestionHow to send a VB.net project to someone else? Pin
ADY00710-Mar-05 8:27
ADY00710-Mar-05 8:27 
AnswerRe: How to send a VB.net project to someone else? Pin
rwestgraham10-Mar-05 8:59
rwestgraham10-Mar-05 8:59 
AnswerRe: How to send a VB.net project to someone else? Pin
Ray Cassick10-Mar-05 9:01
Ray Cassick10-Mar-05 9:01 
AnswerRe: How to send a VB.net project to someone else? Pin
Dave Kreskowiak10-Mar-05 9:50
mveDave Kreskowiak10-Mar-05 9:50 
GeneralRe: How to send a VB.net project to someone else? Pin
ADY00710-Mar-05 10:00
ADY00710-Mar-05 10:00 
GeneralRe: How to send a VB.net project to someone else? Pin
Dave Kreskowiak10-Mar-05 10:36
mveDave Kreskowiak10-Mar-05 10:36 
GeneralUser Control problem/error Pin
Shawn200010-Mar-05 7:25
Shawn200010-Mar-05 7:25 
Hi,

I have a user control which I am puting a TreeView control onto. I have started to add code to the code-behind to populate the TreeView but am getting real problems. Origonally I had the TreeView working fine on it's own on a form, but wanted to make this more generic so I could use it on many other forms.

The error I am getting is "Object reference not set to an instance of an object", which normally means that something needs to be defined as "new", but I am getting this when I drop the user control on the form.

The code in the user control is as follows:

Public Class ProductSpecItems<br />
    Inherits System.Windows.Forms.UserControl<br />
<br />
    Private Sub ProductSpecItems_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
        Me.treeProductSpecifications.Nodes.Clear()<br />
        Me.treeProductSpecifications.Nodes.Add(New TreeNode("Product Specifications"))<br />
        Dim tNode As New TreeNode<br />
        tNode = Me.treeProductSpecifications.Nodes(0)<br />
<br />
        PopulateTreeView(0, tNode)<br />
        tNode.Expand()<br />
    End Sub<br />
<br />
    Private Sub PopulateTreeView(ByVal inParentID As Integer, ByRef inTreeNode As TreeNode)<br />
        'populate the Product Specifications Tree view<br />
        Dim ParentTable As New DataTable<br />
        Dim ParentRow As DataRow<br />
<br />
        Dim sSQL As String<br />
<br />
        sSQL = "SELECT ID, DESCRIPTION, PARENTID FROM PRODUCTSPECIFICATIONITEM WHERE PARENTID=" & inParentID & " ORDER BY DESCRIPTION"<br />
        ParentTable = SCDatabase1.getDataTable(sSQL)
'<----- IT FAILS ON THIS LINE
    End Sub<br />
End Class


From the above code I have indicated which line it's falling over on.
I have a global class which defines the Database connection as
Public SCDatabase As New Database(StockControlConnectionString)
so I always have it available. I don't know if this is the best way but it works for everything else I have done.

Can someone help me with this as it's driving me mad. I can not understand why I am getting the error when dropping the user control on the form?

Many thanks for the help.
Shawn
GeneralRe: User Control problem/error Pin
Ray Cassick10-Mar-05 8:30
Ray Cassick10-Mar-05 8:30 
GeneralRe: User Control problem/error Pin
Shawn200010-Mar-05 8:38
Shawn200010-Mar-05 8:38 
GeneralRe: User Control problem/error Pin
Dave Kreskowiak10-Mar-05 9:47
mveDave Kreskowiak10-Mar-05 9:47 
GeneralRe: User Control problem/error Pin
Shawn200010-Mar-05 10:23
Shawn200010-Mar-05 10:23 
Generaldataset sharing between forms Pin
rayfouc10-Mar-05 7:14
rayfouc10-Mar-05 7:14 
GeneralRe: dataset sharing between forms Pin
Raistlin21_4510-Mar-05 8:00
Raistlin21_4510-Mar-05 8:00 
GeneralRe: dataset sharing between forms Pin
j45mw12-Mar-05 17:12
j45mw12-Mar-05 17:12 
Generalplaying a wav file Pin
Raistlin21_4510-Mar-05 7:07
Raistlin21_4510-Mar-05 7:07 
GeneralHelp Required Upgrading VB6 project to VB Net -&gt; specifically VarPtr solution Pin
Quenchmaster10-Mar-05 1:40
Quenchmaster10-Mar-05 1:40 
GeneralRandom Number Generator Pin
jarlath9-Mar-05 23:35
jarlath9-Mar-05 23:35 
GeneralRe: Random Number Generator Pin
J4amieC10-Mar-05 5:02
J4amieC10-Mar-05 5:02 
GeneralRe: Random Number Generator Pin
jarlath10-Mar-05 11:12
jarlath10-Mar-05 11:12 
QuestionHow to make a start up form using the coding. Pin
ADY0079-Mar-05 22:59
ADY0079-Mar-05 22:59 
AnswerRe: How to make a start up form using the coding. Pin
Dave Kreskowiak10-Mar-05 5:11
mveDave Kreskowiak10-Mar-05 5:11 
Generalabt c graphics Pin
Anonymous9-Mar-05 19:41
Anonymous9-Mar-05 19:41 
GeneralRe: abt c graphics Pin
Dave Kreskowiak10-Mar-05 5:08
mveDave Kreskowiak10-Mar-05 5:08 
GeneralDatabase in Sql Server Pin
eshban2849-Mar-05 19:25
eshban2849-Mar-05 19:25 

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

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