Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » General Visual Basic » RichTextBox doesn't work


RichTextBox doesn't workExpand / Collapse
Author
Message
Posted 3/8/2005 12:00:48 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 10/31/2006 12:01:24 PM
Posts: 85, Visits: 7
Something is definitely wrong with vb4. I added richtextbox's and now the program crahes every time it meets one. I get a message saying:

Method or Data Member Not Found.

 I ve written the code both ways:

RichTextBox1.Text or RichTextBox1.TextRTB and also RichTextBox1.RichTextBox

It still crashes and I get the same message.

The RTB logo is defintely on My Toolbox. Also the Properties show 10 different RichTextBox?.RichTextBox 's
The question mark replaces the 10 numbers. I also got a message:

Object Sever not Correctly Registered

when I did a control-T to put the the RichTextBox Logo on My Toolbox. How can I make this thing work right?

Post #9303
Posted 3/8/2005 1:09:47 PM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: 4/13/2009 1:04:38 PM
Posts: 910, Visits: 5,436

try re-registering your RichText ocx

regsvr32 c:\Windows\system32\richtx32.ocx

 



Wayne

I know enough to be dangerious.

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.

Post #9322
Posted 3/8/2005 7:09:31 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 10/31/2006 12:01:24 PM
Posts: 85, Visits: 7

Wayne

I typed the code you showed and it said that the register Suceeded. BUT when I ran The Code it High Lited "Text" on select case RichTextBox1.text and  a message saying: Method or Data Member Not Found. I'm at my wits end.  The thing goes from a 3 column 2 a 2 column Toolbox and the RTB Icon is displayed in both. Any Ideas?

Private Sub RichTextBox1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Dim Z@
   No% = 0
   If KeyCode = 27 Then
      Back2_3 14
   End If
   If KeyCode = 13 Then
   NumRec = Cnf(Regg%).P + 1
   Select Case RichTextBox1.Text

Post #9334
Posted 3/8/2005 7:55:56 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 6/21/2006 8:59:41 AM
Posts: 72, Visits: 204

I see your problem!

You have a control array of rich text boxes.  Control arrays are 'kinda' wierd, 'kinda' cool.  When you have a control array, cannot access the Text property in the way you think.  You see, there is exactly 1 Key Down event for all 10 rich text box's.  So, you have to specify which text box you want to use.  The index that you see on the parameter line specifies which rich text box had a key pressed in it.

Replace RichTextBox1.Text

With

RichTextBox1(index).Text

 

Hope it helps.

Post #9335
Posted 3/8/2005 8:05:47 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 10/31/2006 12:01:24 PM
Posts: 85, Visits: 7

I didn't make an array unless the program automatically makes an array. I will certainly try what you have given me and I think it will work because it seems logical. Although if VB were logical they would have hada Keydown event for every Box.

I hope this solves my problems with going from Text box to text box or this will all be in VAIN!! THamks again for you help, i appreciate it!

Post #9336
Posted 3/8/2005 8:53:18 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 6/21/2006 8:59:41 AM
Posts: 72, Visits: 204

You can have a keydown for every event.  If you add the rich text boxes from the toolbox one at a time, each control will have an event.

I know this is a 'control array' issue because you have an index parameter.

You can easily duplicate what it is I am explaining.  Start a new project ( so you don't mess with this one ).  Double-Click the command button in the toolbox.  A button is added to the center of your form.  Double click the command button again.  Now, move the buttons so they are not on top of each other.  Double Click on the first button.  You'll see that it create a click event procedure for Command1.  Now double click on the second button.  There will be an additional click event proecedure for the second button.

Now, to duplicate the control array.  Double Click the command button in teh tool box.  A Command 3 button will be added to the form.  Now Click on the command 2 button.  Press CTRL-C and then CTRL-V.  VB will ask you if you want to make a control array.  If you click YES, a control array will be created.

Truth be told, I think Control Arrays are kinda dumb for stuff like text boxes and command buttons.  They do come in handy when you have a bazillion check boxes or radio buttons.

I hope I explained this well.  If not, let me know.

Post #9337
Posted 3/8/2005 9:10:31 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 6/21/2006 8:59:41 AM
Posts: 72, Visits: 204
What problem are you having going from text box to text box? 
Post #9339
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:00am