borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Let's Discuss VB.Net Against VB)Next Topic (Annoying Date Problem) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Force Carriage Return in Textbox
Poster Message
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 288

icon Force Carriage Return in Textbox

Hi guys

I have a Multi-Line Text box set up as a notes field for my database, what I am trying to do is start each entry with the Date & Time, and I need to start each entry on a new line like this:

13/7/2003 (10:30) : blah blah blah

14/7/2003 (11:00) : more blah blah

I was trying to use this line of code under the edit button of my database, so that when it was clicked by a user a new line was started and the date added:-

TxtNotes = TxtNotes & vbCr & Date & ": "

This entered the date for me but the carriage return came up as "|", how do I force a carriage return in a Multi line Text Box??

      

Shady

____________________________
I don't wanna die... but I ain't keen on livin' either

14-07-2003 at 02:56 PM
View Profile Send Email to User Show All Posts | Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 288
icon Re: Force Carriage Return in Textbox

Okay,

So I found the answer to that one, I just use vbCrLf instead of vbCr.

But I have a new but related query, I waant to user the line TxtNotes=TxtNotes & vbCrLf & Date &": "
but how do I position the cursor at the end of the colon to begin typing

If I use TxtNotes.setfocus then the cursor always appear in the top left of the box and not after the date

Shady

____________________________
I don't wanna die... but I ain't keen on livin' either

14-07-2003 at 03:05 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1137
icon Re: Force Carriage Return in Textbox

Private Sub Command1_Click()

    Text1.SelStart = Len(Text1.Text)
    Text1.SetFocus

End Sub


Steve




[Edited by steve_w on 14-07-2003 at 03:20 PM GMT]

14-07-2003 at 03:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
Shock
Level: Wizard


Registered: 30-03-2003
Posts: 148
icon Re: Force Carriage Return in Textbox

Is it just me....Or is VBNewLine an easier way of forcing a carriage return??

Also, For what your doing, I have a suggestion that might help you (just an Idea I thought up when reading your post).

Set up a subroutine that everytime you press enterkey (I really forget the VBkey value of that one :/ ) It runs a subroutine that INPUTs for the monthyearday however you need it, then sets your TextNotes string as a sum of what was inputted. The program will automatically Append a Carrier return (or two) and Put the cursor at the end of your text. Then, of course, once youd press ENTER again (or cntrl-enter lets say depending on how you want your entries to look) it would save your string to a file (I can help you with that one). This would work well if you ad a main form with the text on it, so you could scroll.

so lets say you want to make an entries, youd just run the program, press enter, type in the date, and your entry, press your 'end key' and close the program.

me and my Ideas...

[Edited by Shock on 18-07-2003 at 12:31 PM GMT]

18-07-2003 at 12:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Force Carriage Return in Textbox
Previous Topic (Let's Discuss VB.Net Against VB)Next Topic (Annoying Date Problem) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder