code for textbox

hi there

i am new for vb 6

i want know code that when i type " A " in textbox Then listbox show all record from database startin with " A " letter

i write code it is wrong or not i don't know

here is my code


Private Sub Text1_Change()
    If Len(Text1.Text) > 0 Then
        List1.Visible = True
       recordadd "companymaster", "companyname", Text1.Text, List1
    Else
        List1.Visible = False
    End If


Public Sub recordadd(tabl As String, rsfield As String, s As String, l As ListBox)
    Dim str As String
    Dim strsql As String

    str = s & "*"
    strsql = "select * from " & tabl & " where " & rsfield & " like '" & str & "' "

    If Len(str) > 0 Then
        rs.Open strsql, cn, adOpenDynamic, adLockReadOnly
        l.Clear
        Do While Not rs.EOF                         '( here Rs.Eof is true even data is upto 2008 no )
        l.AddItem rs.Fields(1).Value
            rs.MoveNext
        Loop
        rs.Close
        Else
        l.Clear
    End If
End Sub

please let me know as early possible as

 

thanking you

Jayesh Patel 

Submitted byadminon Sat, 05/30/2009 - 14:34

I guess you are using ADO to connect to your database.

If this is the case, just replace the arterisk (*) with percent (%) symbol. 

hello,

how are you great vb master

i told u that i am new in vb

i learn vb 6 by myself with anybody's help

here i made a form like salebill for Pharmacy

 this form have

bill no:-  , Patient Name:- , Doctor Name :-, Date:- , these are textbox and labels

i also use MshFlexgrid for many items which purchse patient

may be u understand what type of sale bill is this

now i save this data to database and this record is show on display on form

i want this current record to print

how can i ?

i use ADO connection to Access  Database and also SQL 7 as Database

Please let me know code for print

i didn't write any code for it ,,, i don't know how to write

 

thanking you great vb master

 

jayesh patel

 

 

hi, it very long time some body suggest use vb.net program for create own software i use vb.net my problem is i use vb6 code in vb.net it dose not work i think i use older version code for new version i am trying to create table in sqldatabase using ado connection my code in vb6 is cn.execute ("create table Table_Name" , ( " _ & " [ UserName ][ Varchar ](50)Null Default " it create table in sql server but what is code in vb.net like above code is there any code for vb.net thanking you jayesh

Add new comment