Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simulating the VB Code window at runtime 1

Status
Not open for further replies.

Maizey

Programmer
Aug 22, 2000
1
GB

A desparately time-constrianed plee for help.

I am trying to develop a prototype for a very simple VB5 CBT application, that requires the inclusion of a simulated VB code window to allow the user to enter VB code for an event then on a button click-event, will validate the text against a pre-defined model code answer.

I have constructed the simulated window with a code window screen dump as a background and a couple of text boxes. I have also successfully achieved a rudamentary level of string comparison and have almost, but not completely managed to successful detect and strip out carriage returns and end of line spaces to improve the validation of the comparision. Any help on functions or methods etc that will improve the comparision and make it a little more flexible would be greatly appreciated.

More critically, could you tell me if there is a way to simulate how VB will format, i.e. change the colour of, key reserved words such as IF, THEN, ELSE etc. I have looked at the RichTextBox control's functionality which does allow for the formatting of substrings (words/paras) including font colour, but the example that I found seemsmore to be a feature that will change the colour at run time where the user must manually select the text within the text box then use a form control to set the colour. Is the RichTextBox the way to go, or is there another method.

Any help you can give me on either of the above queries, or indeed any advice on simulation or CBT development using VB would be most graciously appreciated. My apologies in advance if the answers to these questions are very simple and I consequently I appear very stupid - but I'm young, starting out and a fairly novice programmer in VB but am under the extreme pressure of a non-movable deadline of this Thursday to deliver the protoype. Thus any advice (other than change job) would be very welcome.

Thank you, in eagar anticipation of a favourable reply (is that enough creeping)

Nikki
 
Have you tried SelColor?

RichText.SelColor = {Color}

This will change the Selected Text (SelText) to what ever the value resolves. In your case the Selected Text to be changed would be Conditions and other Statements Blue and Rem's Green etc. Using the SelLength,SelText, and SelStart would be VERY useful in this.

Hope this Helps,
John Stephens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top