Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-2008, 11:49 PM
yonghan yonghan is offline
Newbie
 
Join Date: May 2008
Posts: 19
Credits: 0
Rep Power: 2
yonghan is on a distinguished road
Default Need help

Guys..i need help please..I got problem when i delete data,the program close after it..Here are the code..Please help me..Thanks a lot..
Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Dim intJawab As Byte
    Dim strGolonganID, strSupplierID As String
    Dim j As Integer
    
    j = rsPerusahaan.RecordCount
    Select Case Button.Key
        Case "New"
            
            If j <> 0 Then
            MsgBox "You can't add a new data", , "Warning"
            Else
            If Not StatusBar1.Panels(1).Text = "Ready" Then
                Exit Sub
            Else
                StatusBar1.Panels(1).Text = "New"
                EnableColor
                EnableForm
                ClearForm
                DisableLock
                
                
            End If
           End If
        Case "Save"
            If Not StatusBar1.Panels(1).Text = "New" And Not StatusBar1.Panels(1).Text = "Edit" Then
                Exit Sub
            Else
            
                If StatusBar1.Panels(1).Text = "New" Then
                    If Validate Then
                        intJawab = MsgBox("Save new data?", vbYesNoCancel + vbExclamation, "Save data")
                        If intJawab = 6 Then    'vbYes
                            rsPerusahaan.AddNew
                            rsPerusahaan!nama = IIf(Not IsNull(txtNama.Text), txtNama.Text, "")
                            rsPerusahaan!alamat1 = IIf(Not IsNull(txtAlamat1.Text), txtAlamat1.Text, "")
                            rsPerusahaan!alamat2 = IIf(Not IsNull(txtAlamat2.Text), txtAlamat2.Text, "")
                            rsPerusahaan!Kota = IIf(Not IsNull(txtKota.Text), txtKota.Text, "")
                            rsPerusahaan!Zip = IIf(Not IsNull(txtZip.Text), txtZip.Text, "")
                            rsPerusahaan!telepon = IIf(Not IsNull(txtPhone.Text), txtPhone.Text, "")
                            rsPerusahaan!fax = IIf(Not IsNull(txtFax.Text), txtFax.Text, "")
                            rsPerusahaan!kontak = IIf(Not IsNull(txtKontak.Text), txtKontak.Text, "")
                            rsPerusahaan!NPWP = IIf(Not IsNull(txtNPWP.Text), txtNPWP.Text, "")
                            rsPerusahaan!Ket1 = IIf(Not IsNull(txtKet1.Text), txtKet1.Text, "")
                            rsPerusahaan!Ket2 = IIf(Not IsNull(txtKet2.Text), txtKet2.Text, "")
                            rsPerusahaan!Ket3 = IIf(Not IsNull(txtKet3.Text), txtKet3.Text, "")
                            rsPerusahaan.Update
                            MsgBox "Successfully saved."
                        Else
                            If intJawab = 7 Then    'vbNo
                                MsgBox "No"
                            Else
                                MsgBox "Cancel"     'vbCancel
                            End If
                        End If
                    End If
                Else
                    If StatusBar1.Panels(1).Text = "Edit" Then
                       
                       
                        intJawab = MsgBox("Would you save the edited data?", vbYesNoCancel + vbExclamation, "Save data")
                        If intJawab = 6 Then    'vbYes
                            rsPerusahaan.Edit
                            rsPerusahaan!nama = txtNama.Text
                            rsPerusahaan!alamat1 = txtAlamat1.Text
                            rsPerusahaan!alamat2 = txtAlamat2.Text
                            rsPerusahaan!Kota = txtKota.Text
                            rsPerusahaan!Zip = txtZip.Text
                            rsPerusahaan!telepon = txtPhone.Text
                            rsPerusahaan!fax = txtFax.Text
                            rsPerusahaan!kontak = txtKontak.Text
                            rsPerusahaan!NPWP = txtNPWP.Text
                            rsPerusahaan!Ket1 = txtKet1.Text
                            rsPerusahaan!Ket2 = txtKet2.Text
                            rsPerusahaan!Ket3 = txtKet3.Text
                            rsPerusahaan.Update
                            MsgBox "Successfully saved."
                        Else
                            If intJawab = 7 Then    'vbNo
                                MsgBox "No"
                            Else
                                MsgBox "Cancel"     'vbCancel
                            End If
                        End If
                    End If
                End If
            End If
            'DisableForm
            DisableColor
            StatusBar1.Panels(1).Text = "Ready"
        Case "Undo"
            If StatusBar1.Panels(1).Text = "New" Or StatusBar1.Panels(1).Text = "Save" Or StatusBar1.Panels(1).Text = "Edit" Or StatusBar1.Panels(1).Text = "Delete" Then
                ClearForm
                EnableLock
                DisableColor
                'DisableForm
                StatusBar1.Panels(1).Text = "Ready"
            Else
                Exit Sub
            End If
        Case "Del"
            StatusBar1.Panels(1).Text = "Delete"
                              
                intJawab = MsgBox("Are you sure to delete this data?", vbYesNo + vbExclamation, "Delete")
                If intJawab = 6 Then 'vbYes
                rsPerusahaan.Delete
                'rsPerusahaan.Edit
                'rsPerusahaan!RS = "D"
                MsgBox "Successfully deleted."
                
                Else
                End If
                'EnableColor
                'EnableForm
                'DisableLock
                
            End
        Case "Edit"
       
       StatusBar1.Panels(1).Text = "Edit"
       Case "Exit"
            Unload Me
        
    End Select
End Sub

Last edited by v0id; 05-08-2008 at 12:54 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-08-2008, 02:51 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 7,055
Last Blog:
Web slideshow in JavaS...
Credits: 1,024
Rep Power: 58
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Need help

Sorry, I don't follow. What's the problem?
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-09-2008, 01:37 AM
yonghan yonghan is offline
Newbie
 
Join Date: May 2008
Posts: 19
Credits: 0
Rep Power: 2
yonghan is on a distinguished road
Default Re: Need help

The problem is that when i have deleted the only data,the program automatically closed..Are there a way so it won't be closed automatically after i delete the data?Thanks a lot..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-09-2008, 02:39 AM
gaylo565's Avatar   
gaylo565 gaylo565 is offline
Programmer
 
Join Date: May 2007
Location: flagstaff, az
Posts: 178
Last Blog:
String Manipulation wi...
Credits: 101
Rep Power: 9
gaylo565 is a jewel in the roughgaylo565 is a jewel in the roughgaylo565 is a jewel in the rough
Default Re: Need help

looks like there is an extra end in your del case right at the end of the case. dont know if this is causing the problem but i bet its not helpin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-09-2008, 10:45 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 7,055
Last Blog:
Web slideshow in JavaS...
Credits: 1,024
Rep Power: 58
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Need help

Code:
Case "Del"
            StatusBar1.Panels(1).Text = "Delete"
                              
                intJawab = MsgBox("Are you sure to delete this data?", vbYesNo + vbExclamation, "Delete")
                If intJawab = 6 Then 'vbYes
                rsPerusahaan.Delete
                'rsPerusahaan.Edit
                'rsPerusahaan!RS = "D"
                MsgBox "Successfully deleted."
                
                Else
                End If
                'EnableColor
                'EnableForm
                'DisableLock
                
            End
You've included the word End at the end. Of course it's going to close - that's what the End statement does!
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 05-09-2008, 10:25 PM
yonghan yonghan is offline
Newbie
 
Join Date: May 2008
Posts: 19
Credits: 0
Rep Power: 2
yonghan is on a distinguished road
Default Re: Need help

ok,thanks a lot..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 05:19 AM.

Contest Stats

Xav ........ 1024.41
MeTh0Dz|Reb0rn ........ 974.08
morefood2001 ........ 850.04
John ........ 841.93
WingedPanther ........ 661.52
marwex89 ........ 575.59
Brandon W ........ 456.18
chili5 ........ 292.12
orjan ........ 187.41
Steve.L ........ 181.88

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 79%

Ads