Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Pretrazivac u Visual Basicu ?

[es] :: Visual Basic 6 :: Pretrazivac u Visual Basicu ?

[ Pregleda: 5184 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

zelja
Zeljko Antesevic

Član broj: 1761
Poruke: 5
195.252.78.*



Profil

icon Pretrazivac u Visual Basicu ?10.01.2002. u 22:30 - pre 270 meseci
1.Kako da postavim pretrazivac "Find" na komandnom dugmetu u nekom programu Visual Basica 6.0 ?

Do sada mi je to na nekim programima radilo ali sada nece nikako, pretrazivac sam napisao i postavio u komandno dugme u ovom kodu:

prompt$ = "Upisi puni trazenog teksta"
'Uzeti string koji ce se koristiti za trazenje u polju ClassName
SearchStr$ = InputBox(prompt$, "Course Search")
Data1.Recordset.Index = "Ime" 'Izabrati polje Ime
Data1.Recordset.Seek "=", SearchStr$ 'i traziti
If Data1.Recordset.NoMatch Then 'ako nije pronadjen takav naziv
Data1.Recordset.MoveFirst 'preci na prvi zapis
End If

 
Odgovor na temu

steewsc
Trajanovic Stevica
Cicevac Town

Član broj: 10379
Poruke: 237
62.193.131.*



+5 Profil

icon Re: Pretrazivac u Visual Basicu ?23.05.2003. u 17:37 - pre 253 meseci
I ja sam pokushao na taj nachin pa nisam mogao da nishta da uradim.
Treba da pokushash sa sledecim kodom:

-----------CODE----------
form1.data1.recordset.movefirst
10 if form1.txtfields(0).text=text1.text then
'neka poruka'
else
form1.data1.recordset.movenext
goto 10
end if
-----------CODE----------
Forma za ovaj primer treba da sadrzi:
1.Dva Textbox-a
-name: Text1
-name: txtfields(0) (ovo ime je ime textbox-a koje je povezano sa bazom)
-polje 'txtfields' treba da bude povezano sa bazom (poljem u njoj)
2.CommandButton
-name:command1
-Napisan kod vazi za commandbutton
www.cicevac.com
†StEEwSc†
 
Odgovor na temu

steewsc
Trajanovic Stevica
Cicevac Town

Član broj: 10379
Poruke: 237
62.193.131.*



+5 Profil

icon Re: Pretrazivac u Visual Basicu ?27.05.2003. u 17:46 - pre 253 meseci
Zadnji put nisam mogao da ti poshaljem sve jer nisam bio kuci vec u InternetClub-u,
a izvorni kod nisam imao kod sebe vec sam napisao odprilike kako bi to trebalo da radi.
Sad ti shaljem CEO izvorni kod programa za pretragu po DataBase-u. OVO SIGURNO RADI !!!
VEC JE ISPROBANO NA PROGRAMU KOJI SAM PRAVIO ZA JEDNU PRODAVNICU !!!!
Name forme (objekata) pishesh bez " " (npr. frmfind, txtfields(0),cmdAdd itd.)
-- - - - - - - -- -- - - - -- - - -- - - - - -- - - -- -- -- -- - - - -- -- -- - - -- --- -- -- - - - - -- - - -- - -- - - - - - -- - -- - - -
Treba da napravis 3 forme:
-"frmfind"
-"Form1"
-"Form2"
-- - - - - - - -- -- - - - -- - - -- - - - - -- - - -- -- -- -- - - - -- -- -- - - -- --- -- -- - - - - -- - - -- - -- - - - - - -- - -- - - -
"frmfind" treba da sadrzi sledece objekte:
TextBox- "txtfields(0)"
- "txtfields(1)"
CommandButton- "cmdAdd"
- "cmdDelete"
- "cmdRefresh"
- "cmdUpdate"
- "cmdClose"
- "Command1"
- "Command2"
Data-"Data1"
Ovo treba da bude povezano sa bazom koja ima 2 polja ("ime" i "broj")
"RecordSourse"="imenikt" (Neznam da li je i ovo vazno)

Ovako treba da izgleda kod za formu "frmfind"
------------------------------------------------------------------------------------
Option Explicit

Private Sub cmdAdd_Click()
Data1.Recordset.AddNew
End Sub

Private Sub cmdDelete_Click()
'this may produce an error if you delete the last
'record or the only record in the recordset
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End Sub

Private Sub cmdRefresh_Click()
'this is really only needed for multi user apps
Data1.Refresh
End Sub

Private Sub cmdUpdate_Click()
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub Command1_Click()
Data1.Recordset.OpenRecordset
Form1.Show
End Sub

Private Sub Command2_Click()
Data1.Recordset.OpenRecordset
Form2.Show
End Sub

Private Sub Data1_Error(DataErr As Integer, Response As Integer)
'This is where you would put error handling code
'If you want to ignore errors, comment out the next line
'If you want to trap them, add code here to handle them
MsgBox "Data error event hit err:" & Error$(DataErr)
Response = 0 'throw away the error
End Sub

Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
'for dynasets and snapshots
Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
'for the table object you must set the index property when
'the recordset gets created and use the following line
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub

Private Sub Data1_Validate(Action As Integer, Save As Integer)
'This is where you put validation code
'This event gets called when the following actions occur
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
Screen.MousePointer = vbHourglass
End Sub
-- - - - - - - -- -- - - - -- - - -- - - - - -- - - -- -- -- -- - - - -- -- -- - - -- --- -- -- - - - - -- - - -- - -- - - - - - -- - -- - - -

"Form1" treba da sadrzi sledece objekte:
TextBox-"Text1"
CommandButton-"Command1"
Ovako treba da izgleda kod za formu "Form1"
------------------------------------------------------------------------------------
Option Explicit

Private Sub Command1_Click()
frmfind.Data1.Recordset.OpenRecordset
frmfind.Data1.Recordset.MoveFirst
10 If frmfind.txtFields(0).Text = Text1.Text Then
Dim store As String
store = frmfind.Data1.Recordset.Fields("ime").ValidationText
Else
frmfind.Data1.Recordset.MoveNext
GoTo 10
End If
End Sub
-- - - - - - - -- -- - - - -- - - -- - - - - -- - - -- -- -- -- - - - -- -- -- - - -- --- -- -- - - - - -- - - -- - -- - - - - - -- - -- - - -

"Form2" treba da sadrzi sledece objekte:
TextBox-"Text1"
CommandButton-"Command1"
Ovako treba da izgleda kod za formu "Form2"
------------------------------------------------------------------------------------
Option Explicit

Private Sub Command1_Click()
frmfind.Data1.Recordset.OpenRecordset
frmfind.Data1.Recordset.MoveFirst
10 If frmfind.txtFields(1).Text = Text1.Text Then
Dim store As String
store = frmfind.Data1.Recordset.Fields("broj").ValidationText
Else
frmfind.Data1.Recordset.MoveNext
GoTo 10
End If
End Sub
-- - - - - - - -- -- - - - -- - - -- - - - - -- - - -- -- -- -- - - - -- -- -- - - -- --- -- -- - - - - -- - - -- - -- - - - - - -- - -- - - -

www.cicevac.com
†StEEwSc†
 
Odgovor na temu

[es] :: Visual Basic 6 :: Pretrazivac u Visual Basicu ?

[ Pregleda: 5184 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.