Ironworks Gaming Forum

Ironworks Gaming Forum (http://www.ironworksforum.com/forum/index.php)
-   General Conversation Archives (11/2000 - 01/2005) (http://www.ironworksforum.com/forum/forumdisplay.php?f=28)
-   -   VB Question (http://www.ironworksforum.com/forum/showthread.php?t=84648)

LennonCook 03-10-2003 02:14 AM

<font color="lightblue">How do you force a newline in a rich text box ??</font>

Jay&SilentBob 03-10-2003 03:47 AM

When I saw this thread the one and only thought to come to my head was has comeone else discovered the wonders of VB beer :D

wellard 03-10-2003 05:08 AM

Quote:

Originally posted by Jay&SilentBob:
When I saw this thread the one and only thought to come to my head was has comeone else discovered the wonders of VB beer :D
As I write this, the ice cold VB beside me winks with a c'mon sultry look upon its dew laden exterior [img]graemlins/heee.gif[/img]

lennon cook please explain *p.hanson voice* :D

Night Stalker 03-10-2003 09:56 AM

Run time or design time. At run time the RTbox traps all standard ASCII keys but tab. So to add a new line at run time, just type the 'enter' key.
You must make sure the custom property "Mulit-line" is true (checked).

Djinn Raffo 03-10-2003 12:42 PM

Not sure if this is what you mean or not but..

& vbCrLf

or

& vbNewLine

and their are a couple of others as well.

if your rich text box is named txtRTB

you would say

txtRTB = txtRTB & vbCrLf

or if you were using a string variable

strString = "A line of text" & vbCrLf & "Another Line of text"
txtRTB = strString

would look like this:

A line of text
Another line of text

[ 03-10-2003, 12:43 PM: Message edited by: Djinn Raffo ]

Downunda 03-10-2003 02:07 PM

I too thought the question was regarding the emerald coloured beverage of choice for many Australians but then I read Sookmas post and figured it actually stood for Very Boring Question ;)

LennonCook 03-10-2003 03:39 PM

<font color="lightblue">Thanks, Djinni [img]smile.gif[/img]
Downunder - just wait until you see what 'boring' things this does :D

One other question... my program doesn`t like Object.SetFocus in one case, but does it properly when I use the same code elsewhere in the code...
The only two differences I can find between the one that does work and the one that doesn`t:
- The one that doesn`t is in a subprogram that fires on Form_Load
- The one that doesn`t work is at the End of that subprogram, ie. last thing before the End Sub.
Could either of those have anything to do with it ??
The error it returns is "Invalid Function". </font>

andrewas 03-10-2003 04:28 PM

At form load, the object might not exist yet. Assuming thats the one that isnt working, your not exactly very clear on that point.

Night Stalker 03-10-2003 04:52 PM

If you can avoid it, don't use an untyped object or variant. While flexible, you don't know the type until runtime.

Now for your ? ....

It seems there is an invalid object reference in your sub. Are you passing the proper object? Does your object have the proper scope? e.i Is it a module global or a local to the _Load event? If it's local to _Load, then it is out of scope in the sub. Also, use a typed object variable. If the object is a textbox, declare it as a textbox ... this will help you at design time.

MAKE SURE YOU HAVE THIS STATEMENT IN EACH CODE MODULE AS THE FIRST LINE
.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">OPTION EXPLICIT</pre>[/QUOTE]This forces variables to be specifically declared. Otherwise, if not declared in a particular scope, VB will create a new variable as variant. Goto to Tools '--> Options
and make sure the "Require variable declaration" option is checked. This makes VB put the statement in.

Always declare variables like this

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">dim var as type</pre>[/QUOTE]If you leave out the type, it is declared as a variant.

Night Stalker 03-10-2003 04:59 PM

No, all controls have been created by the time the _Load event fires. For more info check the topic "Life Cycle of Visual Basic Forms" in the Help section.


All times are GMT -4. The time now is 04:25 AM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved