i work with vb6.
i have problem in my project.
I have 2 forms visualized at the same time.
in form1 I have an array of richtextbox1;
in form2 I have an array of richtextbox2;
when I fill richtextbox1, index (0), the same text is inserted in richtextbox2, example index(1) in form2.
this is also worth for the other richtextbox1.
in form2, there are richtextbox2 that I must directly fill, (they don't have the correspondent in form1).
in form1 I have inserted this code:
Option Explicit Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Const GWL_EXSTYLE = (-20) Const WS_EX_TRANSPARENT = &H20& Dim Index As Integer Dim a As String Dim b As String Private Sub Form_Activate() RichTextBox1(0).SetFocus End Sub Private Sub Form_Load() Form1.Left = Form_Main.Left + 700 Form1.Top = Form_Main.Top + 1700 Form2.Show Dim Control As Control Dim result As Long For Each Control In Form1.Controls If TypeOf Control Is RichTextBox Then result = SetWindowLong(Control.hWnd, GWL_EXSTYLE, WS_EX_TRANSPARENT) End If Next Control End Sub Private Sub RichTextBox1_GotFocus(Index As Integer) RichTextBox1(Index).SelStart = 0 RichTextBox1(Index).SelLength = Len(RichTextBox1(Index).Text) RichTextBox1(Index).SetFocus End Sub Private Sub RichTextBox1_Change(Index As Integer) On Error GoTo Errhandler Select Case Index Case 0 Form2.RichTextBox2(6).Text = _ Form1.RichTextBox1(0).Text Case 1 a = CStr(Form1.RichTextBox1(1).Text) Form2.RichTextBox2(7).Text = CStr(a) Case 2 a = CStr(Form1.RichTextBox1(1).Text) b = CStr(Form1.RichTextBox1(2).Text) Form2.RichTextBox2(7).Text = CStr(a) + "," + " " + "n°" + " " + (B)/>/>/> Case 3 a = CStr(Form1.RichTextBox1(3).Text) Form2.RichTextBox2(8).Text = CStr(a) Case 4 Form2.RichTextBox2(9).Text = _ Form1.RichTextBox1(4).Text Case 5 a = CStr(Form1.RichTextBox1(4).Text) b = CStr(Form1.RichTextBox1(5).Text) Form2.RichTextBox2(9).Text = CStr(a) + "," + " " + "n°" + " " + (B)/>/>/> and so on.... End Select Errhandler: Exit Sub End Sub
this code works only one time;
I try to explain:
if I write in the richtextbox1s of form1 the text it passes in richtextbox2 of form2;
if I write in the richtextbox2s and then return in form1 and click in a whatever richtextbox1 the vb stops him and the screen is like a butterfly.
I have also tried with "if... elseif..." but I have the same problem.
I don't understand the problem.
how do I modify the code?
thanks in advance
best regards

New Topic/Question
Reply



MultiQuote




|