Click here to Skip to main content
16,005,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: saving an AVI with MP3 Pin
Pruck24-Jul-06 3:09
Pruck24-Jul-06 3:09 
GeneralRe: saving an AVI with MP3 Pin
Dave Kreskowiak24-Jul-06 6:32
mveDave Kreskowiak24-Jul-06 6:32 
Questionexecute dts package with VB.net Pin
superabang23-Jul-06 6:15
superabang23-Jul-06 6:15 
QuestionMoving data from access to mySQL Pin
Jhowee23-Jul-06 2:08
Jhowee23-Jul-06 2:08 
QuestionShow Without Activation Pin
The ANZAC22-Jul-06 13:12
The ANZAC22-Jul-06 13:12 
AnswerRe: Show Without Activation Pin
Chatura Dilan23-Jul-06 15:21
Chatura Dilan23-Jul-06 15:21 
QuestionDatagrid row event Pin
iramg22-Jul-06 7:43
iramg22-Jul-06 7:43 
Questionobject reference not set to an instance of an object error Pin
str5022-Jul-06 4:11
str5022-Jul-06 4:11 
I am getting this error when I run the program. I am not sure how to fix this error, if anybody can help me I will appreciate it. The program has two forms. Form1 has the search textbox and form2 takes the information from form1 and populates form2. I have attached the code for both forms, so you can see what I am talking about. Any help will be appreciated. Thanks

Form1 Code:

 Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click<br />
        Dim oForm2Data As New Form2.Form2Data(Me.txtbarcodeid.Text)<br />
<br />
        If oForm2Data.HasData Then<br />
<br />
            Form2.Initialize(Me, oForm2Data)<br />
<br />
        Else<br />
            ' The Data does not exists for the item in the textbox<br />
<br />
        End If<br />
    End Sub<br />


Form2 Code:

Dim dt As New DataTable<br />
    Dim sqlStr As String = "SELECT * FROM testbackup"<br />
    Dim sqlstr1 As String = "SELECT * FROM history"<br />
    Dim connstr As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & _<br />
    "Data Source = backup.mdb"<br />
    Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connstr)<br />
<br />
    Public Shared Sub Initialize(ByVal Owner As IWin32Window, ByRef oForm2Data As Form2Data)<br />
        Dim result As DialogResult<br />
        Dim frm2 As New Form2<br />
<br />
        With frm2<br />
            'Using TheData Populate each Control on Form2<br />
        End With<br />
<br />
        Result = frm2.ShowDialog(Owner)<br />
<br />
        If Result = System.Windows.Forms.DialogResult.OK Then<br />
<br />
<br />
            With frm2<br />
                'Now update the values in TheData with its value in its Form2 Control<br />
            End With<br />
<br />
            'Save Changes<br />
            oForm2Data.SaveData()<br />
        End If<br />
<br />
    End Sub<br />
<br />
    Public Class Form2Data<br />
        Public HasData As Boolean<br />
        Public TheData As DataRow<br />
<br />
        Public Sub New(ByVal Value As String)<br />
            Dim dsData As DataSet<br />
            Dim stSQL As String<br />
<br />
            stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"<br />
<br />
            'Database code to return dataset to dsData<br />
<br />
<br />
            Select Case dsData.Tables(0).Rows.Count<br />
                Case 1 'One Row Returned<br />
                    HasData = True<br />
                    TheData = dsData.Tables(0).Rows(0)<br />
                Case 0 'No Rows Found<br />
                    HasData = False<br />
                    TheData = Nothing<br />
                Case Else 'More then one row returned<br />
                    'Decided how to handle<br />
                    HasData = True<br />
                    TheData = dsData.Tables(0).Rows(0)<br />
            End Select<br />
<br />
<br />
        End Sub<br />
<br />
        Public Sub SaveData()<br />
            'Routine to save the data<br />
        End Sub




AnswerRe: object reference not set to an instance of an object error Pin
mr_lasseter22-Jul-06 4:47
mr_lasseter22-Jul-06 4:47 
GeneralRe: object reference not set to an instance of an object error Pin
str5022-Jul-06 4:58
str5022-Jul-06 4:58 
GeneralRe: object reference not set to an instance of an object error Pin
mr_lasseter22-Jul-06 5:08
mr_lasseter22-Jul-06 5:08 
GeneralRe: object reference not set to an instance of an object error Pin
str5022-Jul-06 5:21
str5022-Jul-06 5:21 
GeneralRe: object reference not set to an instance of an object error Pin
mr_lasseter22-Jul-06 5:32
mr_lasseter22-Jul-06 5:32 
GeneralRe: object reference not set to an instance of an object error Pin
str5022-Jul-06 6:03
str5022-Jul-06 6:03 
GeneralRe: object reference not set to an instance of an object error Pin
mr_lasseter22-Jul-06 6:18
mr_lasseter22-Jul-06 6:18 
GeneralRe: object reference not set to an instance of an object error Pin
str5022-Jul-06 7:42
str5022-Jul-06 7:42 
GeneralRe: object reference not set to an instance of an object error Pin
mr_lasseter22-Jul-06 10:34
mr_lasseter22-Jul-06 10:34 
GeneralRe: object reference not set to an instance of an object error [modified] Pin
str5022-Jul-06 10:52
str5022-Jul-06 10:52 
GeneralRe: object reference not set to an instance of an object error Pin
mr_lasseter23-Jul-06 5:49
mr_lasseter23-Jul-06 5:49 
GeneralRe: object reference not set to an instance of an object error Pin
str5023-Jul-06 12:06
str5023-Jul-06 12:06 
AnswerRe: object reference not set to an instance of an object error [modified] Pin
xivovivovix4-Aug-06 1:42
xivovivovix4-Aug-06 1:42 
QuestionHard disk serial number Pin
mayoush22-Jul-06 3:17
mayoush22-Jul-06 3:17 
AnswerRe: Hard disk serial number Pin
bob1697222-Jul-06 8:07
bob1697222-Jul-06 8:07 
AnswerRe: Hard disk serial number Pin
_mubashir22-Jul-06 8:59
_mubashir22-Jul-06 8:59 
GeneralRe: Hard disk serial number Pin
mayoush23-Jul-06 4:35
mayoush23-Jul-06 4:35 

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.