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

  1. Private Sub Text1_Change()
  2.     If Len(Text1.Text) > 0 Then
  3.         List1.Visible = True
  4.        recordadd "companymaster", "companyname", Text1.Text, List1
  5.     Else
  6.         List1.Visible = False
  7.     End If
  8.  
  9.  
  10. Public Sub recordadd(tabl As String, rsfield As String, s As String, l As ListBox)
  11.     Dim str As String
  12.     Dim strsql As String
  13.  
  14.     str = s & "*"
  15.     strsql = "select * from " & tabl & " where " & rsfield & " like '" & str & "' "
  16.  
  17.     If Len(str) > 0 Then
  18.         rs.Open strsql, cn, adOpenDynamic, adLockReadOnly
  19.         l.Clear
  20.         Do While Not rs.EOF                         '( here Rs.Eof is true even data is upto 2008 no )
  21.         l.AddItem rs.Fields(1).Value
  22.             rs.MoveNext
  23.         Loop
  24.         rs.Close
  25.         Else
  26.         l.Clear
  27.     End If
  28. End Sub

please let me know as early possible as

 

thanking you

Jayesh Patel 

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