Page 5 of 6 FirstFirst ... 23456 LastLast
Results 41 to 50 of 60

Thread: VB 6 need help

  1. #41

    Quote Originally Posted by lestat1116 View Post
    unsa.on pagcheck if naay blank or empty sa database?
    you can do it via recordset object

    e.g.

    if trim(recordset.Fields("IDNo"))="" then
    msgbox "Empty or NULL"
    end if

    OR

    do it in sql statement

    recordset.open "SELECT * FROM table WHERE field1 IS NULL",activeconnection
    if NOT recordset.EOF then
    msgbox "Empty or NULL"
    end if


    I hope I help you with a simple solution


    -ed @ cebujobline.com Team

  2. #42
    Quote Originally Posted by sprocket View Post
    bro naa ko prob gamay about sa vb, ngano mo "object required" mani sya bro kung magbutang ko txtidno.setfocus sa formload?any idea?....
    Private Sub Form_Activate()
    'Ari ibutang imong set focus sa txtbox
    End Sub

    Quote Originally Posted by lestat1116 View Post
    i'll try this. ako man gud ibutang sa module kay gamiton nako sa update ang clear. mas easier kung ibutang sa form.
    Kung gusto ka ibutang sa module ang clear, d ay gamayng function para ana:

    Public Sub ClearDataField(frm As Form)
    On Error Resume Next
    Dim ctrl As Control
    For Each ctrl In frm
    If TypeOf ctrl Is VB.TextBox Then
    ctrl.DataField = 0
    End If

    Next
    End Sub

    Inig tawag nimo sa function: ClearDataField Me

    Me is the form.

    Happy Coding!

  3. #43
    unsa code for mo auto caps ang input?

    how to use try catch if naay mo error?

  4. #44
    Quote Originally Posted by lestat1116 View Post
    unsa code for mo auto caps ang input?
    Create the handler for the Keypress event of the control, assuming it's a Textbox, you can manipulate the KeyAscii as you please, e.g.
    Code:
    private sub myTextBox_Keypress(KeyAscii as integer)
       KeyAscii = Asc(UCase$(Chr$(KeyAscii))) ' Untested code for upcasing a character
    end sub
    Quote Originally Posted by lestat1116 View Post
    how to use try catch if naay mo error?
    If this is still VB6, only On Error statements that are available. You can do something like:
    Code:
    function myFunc()
    on error goto myErrorCatcher
    
        ' some code here
    myFuncExit:
        exit function
    
    myErrorCatcher:
        ' apply logic on what to do with each error, possibly display it to the User
        ' if err = 2051 then etc.
        MsgBox "[" & err & "] - " & err.Description
    
        ' you can use Resume, Resume Next, Resume <goto_pointer>
        ' e.g.
        Resume myFuncExit
    end function

  5. #45
    Quote Originally Posted by SYNCH View Post
    Create the handler for the Keypress event of the control, assuming it's a Textbox, you can manipulate the KeyAscii as you please, e.g.
    Code:
    private sub myTextBox_Keypress(KeyAscii as integer)
       KeyAscii = Asc(UCase$(Chr$(KeyAscii))) ' Untested code for upcasing a character
    end sub


    If this is still VB6, only On Error statements that are available. You can do something like:
    Code:
    function myFunc()
    on error goto myErrorCatcher
    
        ' some code here
    myFuncExit:
        exit function
    
    myErrorCatcher:
        ' apply logic on what to do with each error, possibly display it to the User
        ' if err = 2051 then etc.
        MsgBox "[" & err & "] - " & err.Description
    
        ' you can use Resume, Resume Next, Resume <goto_pointer>
        ' e.g.
        Resume myFuncExit
    end function
    i'll try this. need jud ni nako ang error trapping. specially sa database/ mo error man gud if naay blank or null. do u have an advice for this? kanang null or blank database.

  6. #46
    Quote Originally Posted by lestat1116 View Post
    i'll try this. need jud ni nako ang error trapping. specially sa database/ mo error man gud if naay blank or null. do u have an advice for this? kanang null or blank database.
    ' tan-awa ang post ni sanggano_boy bro. .
    ' or try lang ni bro:

    txtAddress.Text= IIF (IsNull(rs!Address) or rs!Address="","",rs!Address)

    '

  7. #47
    Quote Originally Posted by rhex_tendo View Post
    ' tan-awa ang post ni sanggano_boy bro. .
    ' or try lang ni bro:

    txtAddress.Text= IIF (IsNull(rs!Address) or rs!Address="","",rs!Address)

    '
    - or -

    txtAddress.Text = rs.Fields("Address") & ""

  8. #48
    unsa comment ninyo ani na code?

    Private Sub txtItemCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    If txtItemCode.Text = "" Then
    'MsgBox "Field is empty", vbInformation
    elseif
    rsItem.Index = "ndxItem"
    If CheckIfExists(rsItem, txtItem.Text) Then
    MsgBox "Item Code does not exists", vbInformation
    Else
    txtQty.SetFocus
    End If
    End If
    End Sub

    Public Function CheckIfExists(ByRef rsRecord As Recordset, ByVal ndxQuery As Variant) As Boolean
    rsRecord.MoveFirst
    rsRecord.Seek "=", ndxQuery

    If rsRecord.NoMatch Then
    CheckIfExists = False
    Else
    CheckIfExists = True
    End If
    End Function


    pagrun nako ani. at first ok. na sayop ko og type more than 4-5 times. ni error dayon cya ni ingon og script out of bounds or something ingana. pero kung masayop 1 -2 times ok ra cya.

  9. #49
    ' la mn ko alam anang way pag.code nim...
    ' ing.ani ako way... hehehe

    Private Sub txtItemCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    KeyAscii=0 ' para dili mu.beep
    If txtItemCode.Text = "" Then
    MsgBox "Field is empty", vbInformation
    Else
    If CheckIfExists("tbl_Item",txtItem.Text) Then
    MsgBox "Item Code does not exists", vbInformation
    Else
    txtQty.SetFocus
    End If
    End If
    End If
    End Sub

    Public Function CheckIfExists(ByVal tblName As String, ByVal strFilter as string) As Boolean
    rs.Open "SELECT fieldName FROM " & tblName & " WHERE fieldName='" & strFilter & "'", cn,3,1

    If rs.EOF Then
    CheckIfExists = False
    Else
    CheckIfExists = True
    End If
    rs.close
    End Function

    ' ambot sakto ba sab kaha ni... limot nko...
    '

  10. #50
    imo kay sql from. ako kay recordset

  11.    Advertisement

Page 5 of 6 FirstFirst ... 23456 LastLast

Similar Threads

 
  1. Need help in VB 6.0 and VB.Net?
    By rhex_tendo in forum Programming
    Replies: 10
    Last Post: 08-31-2010, 01:01 PM
  2. VBS need help
    By ManoyanX in forum Programming
    Replies: 2
    Last Post: 02-12-2010, 07:58 PM
  3. Replies: 1
    Last Post: 04-02-2009, 08:41 AM
  4. Who needs help with their vb/c# projects?
    By Cruzader in forum Programming
    Replies: 19
    Last Post: 02-24-2009, 02:44 PM
  5. Replies: 1
    Last Post: 07-30-2005, 01:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top