Ozetlemek gerekirse..bn bi program yaptım..icindi richtextbox var..ve bunun icindeki kelimeleri arattırıyorum..fakat arattırırken form1.findnext diye bi hata veriyo..aramayı dolaylı olarak yaptırıyorum..yani baska bı forum var ıcınde ıkı textbox ve ıkı buton var..bul ve değiştir icin..kodları asagıya yazıyorum..simdiden teşekkurler..visual basic 6.0 kullanıyorum..
Kod:
Option Explicit Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const HWND_TOPMOST = -1 Private Const HWND_NOTOPMOST = -2 Public TargetPosition As Integer Private Sub Command1_Click() Find TargetPosition + 1 Form1.FindNext = Text1.Text End Sub Private Sub Command3_Click() Form1.RichTextBox1.SelText = Text2.Text End Sub Private Sub Form_Load() On Error Resume Next If Form1.RichTextBox1.SelText "" Then Text1.Text = Form1.RichTextBox1.SelText End If Me.Top = Form1.Top Me.Left = Form1.Left SetWindowPos hwnd, _ HWND_TOPMOST, 0, 0, 0, 0, _ SWP_NOMOVE + SWP_NOSIZE End Sub Dim pos As Integer Dim target As String Public Sub Find(ByVal start As Integer) target = Text1.Text pos = InStr(start, Form1.RichTextBox1.Text, target) If pos > 0 Then TargetPosition = pos Form1.TargetPos = TargetPosition Form1.RichTextBox1.SelStart = TargetPosition - 1 Form1.RichTextBox1.SelLength = Len(target) Form1.RichTextBox1.SetFocus Else MsgBox "Dosya İcinde Aranan Kelime Bulunamadı", vbInformation, "Arama Sonucu" Form1.RichTextBox1.SetFocus End If End Sub
__________________
FindNext Hatası
Programlama0 Mesaj
●20 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- FindNext Hatası