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

Visual Basic

 
Generalvb.net / Crystal Report Pin
partt12-Oct-04 8:30
partt12-Oct-04 8:30 
GeneralRe: vb.net / Crystal Report Pin
Dave Kreskowiak12-Oct-04 9:02
mveDave Kreskowiak12-Oct-04 9:02 
GeneralAppend to a string Pin
Brad Fackrell12-Oct-04 6:06
Brad Fackrell12-Oct-04 6:06 
GeneralRe: Append to a string Pin
Colin Angus Mackay12-Oct-04 6:27
Colin Angus Mackay12-Oct-04 6:27 
GeneralRe: Append to a string Pin
Brad Fackrell12-Oct-04 7:17
Brad Fackrell12-Oct-04 7:17 
GeneralError: Object reference not set to an instance of an object Pin
Mekong River12-Oct-04 4:16
Mekong River12-Oct-04 4:16 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Dave Kreskowiak12-Oct-04 5:22
mveDave Kreskowiak12-Oct-04 5:22 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Mekong River12-Oct-04 23:52
Mekong River12-Oct-04 23:52 
Dave Kreskowiak wrote:
On what line does the exception occur?

This exception occure at the line that is bold:

Private Sub frmCategory_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load

        ' Combine the connection string and connect to database.
        strConnection = strProvider & strDbPath
        'MsgBox(strConnection)
        cnnCat.Open(strConnection)
        cnnCat.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        ' Get the record from the table.
        strCatSql = "SELECT * FROM tblCat"
        rstCat.Open(strCatSql, cnnCat, _
        ADODB.CursorTypeEnum.adOpenKeyset, _
        ADODB.LockTypeEnum.adLockOptimistic)

        ' ... The below code are the same as the one that post before.

    End Sub


Dave Kreskowiak wrote:
It looks like your HIDING the form, not destroying it and creating a new one

Because I was experience with VB6 I used to close the form by Unload Me. When I move to VB.NET I found Show, ShowDialog and Close method but I could not find Unload Me anymore. I think Close might override Unload Me statement. But after I change the close procedure as the code below (the bold code is the code that I block comment or delete from the procedure), the it is working whether I start and close and restart the form many time.

    Private Sub btnClose_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnClose.Click

        ' Prompt the user before close the form.
        dlrUserAnswers = MessageBox.Show("Are you sure you want to close " & _
        "Category form?", "Close Category", MessageBoxButtons.YesNo, _
        MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
        If dlrUserAnswers = DialogResult.Yes Then
            ' Close database connection.
            rstCat.Close()
            cnnCat.Close()
            ' Release the objects to free memory.
            'rstCat = Nothing
            'cnnCat = Nothing
            '' Close the form.
            'Me.Close()
        End If

    End Sub


But one new problem come out when I try to add the record that is duplicate in the database. Whether I use Try Catch End Try to block an exception but I could not work around with the other function such as MoveNext, MovePrevious... Do you have any idea about that?



A thousand mile of journey, begin with the first step.

APO-CEDC
Save Children Norway-Cambodia Office

GeneralRe: Error: Object reference not set to an instance of an object Pin
Mekong River13-Oct-04 1:16
Mekong River13-Oct-04 1:16 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Dave Kreskowiak13-Oct-04 1:47
mveDave Kreskowiak13-Oct-04 1:47 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Mekong River13-Oct-04 4:09
Mekong River13-Oct-04 4:09 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Dave Kreskowiak13-Oct-04 9:16
mveDave Kreskowiak13-Oct-04 9:16 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Mekong River14-Oct-04 16:45
Mekong River14-Oct-04 16:45 
GeneralRe: Error: Object reference not set to an instance of an object Pin
MohammadAmiry14-Oct-04 1:00
MohammadAmiry14-Oct-04 1:00 
GeneralRe: Error: Object reference not set to an instance of an object Pin
Mekong River14-Oct-04 16:38
Mekong River14-Oct-04 16:38 
GeneralReports/Search/Picturebox and access Pin
stevemwangi12-Oct-04 3:02
stevemwangi12-Oct-04 3:02 
GeneralRe: Reports/Search/Picturebox and access Pin
Mekong River12-Oct-04 3:37
Mekong River12-Oct-04 3:37 
GeneralError : Class Does not support Automation Pin
cberam12-Oct-04 1:02
cberam12-Oct-04 1:02 
GeneralRe: Error : Class Does not support Automation Pin
gthompson200512-Oct-04 1:37
gthompson200512-Oct-04 1:37 
GeneralRe: Error : Class Does not support Automation Pin
Anonymous12-Oct-04 17:21
Anonymous12-Oct-04 17:21 
GeneralVb.net combo box control Pin
me_vb_man11-Oct-04 23:48
me_vb_man11-Oct-04 23:48 
GeneralRe: Vb.net combo box control Pin
J4amieC12-Oct-04 1:40
J4amieC12-Oct-04 1:40 
GeneralRe: Vb.net combo box control Pin
me_vb_man12-Oct-04 5:29
me_vb_man12-Oct-04 5:29 
GeneralRe: Vb.net combo box control Pin
J4amieC12-Oct-04 8:22
J4amieC12-Oct-04 8:22 
GeneralVB.NET editor very slow Pin
Microlan11-Oct-04 21:50
Microlan11-Oct-04 21:50 

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.