Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21694

richtexbox array

$
0
0
hi, greet to everybody
i have a problem with vb6.

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:
Code:

Private Sub Form_Activate()   
RichTextBox1(0).SetFocus   
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 but 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 flashing.
how do I modify the code?

thanks

best regards

Viewing all articles
Browse latest Browse all 21694


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>