ZFGC

Resources => Coding => Topic started by: AoDC on October 13, 2006, 01:44:21 am

Title: Visual Basic new line character? [Solved =)]
Post by: AoDC on October 13, 2006, 01:44:21 am
I have a MultiLine textbox, and if I wanted to change it, does anybody know what a multiline character would be?

Thanks.
Title: Re: Visual Basic new line character?
Post by: Goodnight on October 13, 2006, 04:15:33 am
Not sure I get the question.. I'm not so good with VB terminology...

vbcrlf might be it?
Title: Re: Visual Basic new line character?
Post by: therabidwombat on October 13, 2006, 04:43:51 am
I had the same problem when I wrote a VB program as well, I put \ns in it, and boy was I shocked when they showed up as \n in the string. It's kind of silly, too, because \n works in C#, C++/CLI, and J#, so you'd think they'd try and make VB follow along the same lines since they're all included in Visual Studio.
Title: Re: Visual Basic new line character?
Post by: AoDC on October 13, 2006, 05:01:30 am
As in, I want so itll be like

txtDisplay.Text = "Line 1
Line 2


Line 5"

or

txtdisplay.Text = "Line1*Line2*" Where * is the New Line marker.
Title: Re: Visual Basic new line character?
Post by: Dayjo on October 13, 2006, 10:33:48 am
txtDisplay.Text ="Line1" & vbcrlf & "Line2"

Goodnight was correct.
Title: Re: Visual Basic new line character?
Post by: AoDC on October 13, 2006, 11:33:32 am
Oh ok. Thanks a bunch Goodnight and Dayjo.
Title: Re: Visual Basic new line character?
Post by: Dayjo on October 13, 2006, 11:35:45 am
No problemo anytime.

What you making in VB anywho?
Title: Re: Visual Basic new line character?
Post by: AoDC on October 13, 2006, 01:23:50 pm
Washing Machine. Its my software des & dev assignment for school. I have an MMO but here I am doing a washing machine. So boring... Everyone in school sucks and is always asking for help :/
Title: Re: Visual Basic new line character?
Post by: Dayjo on October 13, 2006, 02:52:47 pm
you have to create a washing machine..in VB? O.o
Title: Re: Visual Basic new line character?
Post by: AoDC on October 14, 2006, 02:29:08 am
Yes. The class is full of noobs that still dont know why .Text = string without quotation marks doesnt work. My teacher knows alot of Microsoft Access, and some VB, and thats it. We cant go any further.

We dont do games until next year =(. My teacher asks ME for help, and I only learnt VB basics in a day.

Here's the machine:

(http://img.photobucket.com/albums/v217/ageofdarknesscreator/untitled-1.png)

Code:
Code: [Select]
Dim RemSeconds As Integer 'Remaining seconds in timer
Dim RemMinutes As Integer 'Remaining minutes in timer
Dim HasStarted As Boolean 'User has started wash
Private Sub cmdPower_Click() 'When user click power
    If cmdPower.Caption = "Power" Then
        If frmMain.Width = 1395 Then
            frmMain.Width = 8265 'If the form is closed, open it
        Else
            frmMain.Width = 1395 'If it is open, close it
    End If
    Else
        If cmdPower.Caption = "Stop" Then 'If stop is the option
            cmdPower.Caption = "Power" 'Change back to power
            HasStarted = False
            RemSeconds = 60 'Set RemSeconds to 59 by default
            RemMinutes = 1 'Set RemMinutes to user input
            'Reset display text
            txtDisplay.Text = "Ready to Wash" & vbCrLf & vbCrLf & "Please select the appropriate settings."
            vsDirtLevel.Enabled = True 'Enable
            FrameFCare.Enabled = True 'the
            cboTemp.Enabled = True 'options
        End If
    End If
End Sub
Private Sub cmdStartPause_Click()
    If cboTemp.Text = "Temp." Then
        MsgBox "You did not select a temperature. One has been set for you. Cancel the wash to select one."
        cboTemp.Text = "Warm"
    End If
    If cmdStartPause.Caption = "Start" Then 'If the washing has yet to start
        If HasStarted = False Then 'If user has not started washing
            HasStarted = True 'User has started washing
            Timer1.Enabled = True 'Start the seconds timer
            RemSeconds = 60 'Set RemSeconds to 59 by default
            RemMinutes = 1 'Set RemMinutes to user input
            txtDisplay.Text = "Washing..." & vbCrLf & "-----------------" & vbCrLf & "Time Remaining: " & RemMinutes & ":" & RemSeconds 'Update Display
            cmdStartPause.Caption = "Pause" 'Set caption to Pause
            cmdPower.Caption = "Stop" 'Change Power to Stop
            cmdPower.Enabled = False 'Enabled power again
            vsDirtLevel.Enabled = False 'Disable
            FrameFCare.Enabled = False 'the
            cboTemp.Enabled = False 'options
        Else
            Timer1.Enabled = True 'Continue timer
            cmdStartPause.Caption = "Pause" 'Show pause option
            cmdPower.Enabled = False 'disable power button
        End If
    Else
        Timer1.Enabled = False 'stop counting
        cmdStartPause.Caption = "Start" 'Show start option
        cmdPower.Enabled = True 'Enabled power again
    End If
End Sub
Private Sub Form_Load()
    'Timer is not enabled (no countdown yet)
    Timer1.Enabled = False
    'User has not started wash
    HasStarted = False
    'Why not show a little message on startup?
    MsgBox "Thank you for using my Washing Machine.", vbInformation, "Alert"
    'Shrink the GUI on loading to hide controls
    frmMain.Width = 1395
End Sub
Private Sub Timer1_Timer()
    txtDisplay.Text = "Washing..." & vbCrLf & "-----------------" & vbCrLf & "Time Remaining: " & RemMinutes & ":" & RemSeconds 'Update Display
    RemSeconds = RemSeconds - 1 'Remove a second
    If RemSeconds <= 0 Then 'If seconds are less than one
        If RemMinutes <= 0 Then 'If minutes are less than one
            MsgBox "Wash Completed.", vbInformation, "Alert" 'Notify user the wash is complete
            Timer1.Enabled = False 'Stop the timer
        Else
            RemMinutes = RemMinutes - 1 'Remove a minute
            RemSeconds = 60 'Reset seconds to 60
            Timer1.Interval = 1000 'Reset timer to one second
        End If
    End If
    txtDisplay.Text = "Washing..." & vbCrLf & "-----------------" & vbCrLf & "Time Remaining: " & RemMinutes & ":" & RemSeconds 'Update display again to prevent lag
End Sub
Title: Re: Visual Basic new line character?
Post by: Antidote on October 14, 2006, 03:31:40 am
Be careful AoDC or you might winde up TEACHING the class n_n.
What languages do you know???
Title: Re: Visual Basic new line character?
Post by: AoDC on October 14, 2006, 04:15:27 am
rofl. Thatd be right.

A few. Java, C++, VBasic, HTML (language? :/), GML and some C#. Not sure what else.
Title: Re: Visual Basic new line character?
Post by: Antidote on October 14, 2006, 04:37:53 am
That is a pretty good list but i'm NOT going to ask Helios what he knows anywho...
HTML is more of a scripting language because it is interpreted by the browser (being client side)
Title: Re: Visual Basic new line character?
Post by: AoDC on October 14, 2006, 05:08:15 am
Thanks for the intel.

And Helios made a list in some post... it contained a list of about 8 languages :P
Title: Re: Visual Basic new line character? [Solved =)]
Post by: mario_zelda_gamer on October 14, 2006, 05:59:33 am
Thanks for the intel.

And Helios made a list in some post... it contained a list of about 8 languages :P
And that was not all of them, he said he was stopping the list there, so he knows quite a few...

EDIT:
C++ / C# / ObjC / C / BlitzMax / Blitz+ / Blitz3D / Blitz2D / Assembly / Java / Pascal / Delphi / etc.

It would take ages to list the languages I use, as I'm fluent in so many and I switch between them so frequently.

 which reminds me... Could someone PM me with which programming languages I should learn leading up to at least C/C++, plz (like the most basic one through C/C++?
Title: Re: Visual Basic new line character? [Solved =)]
Post by: therabidwombat on October 14, 2006, 06:16:57 am
If you know GML and computer logic than C++ Should be easy. Not saying that GML is much like C++...but the syntax is slightly similar for if statements/for loops/ etc. so it's easy to jump into the basics and work from there.

HTML is more of a scripting language because it is interpreted by the browser (being client side)

Technically HTML is considered a 'Markup' language. HTML stands for HyperText Markup language. Markup is a way of describing data; HTML does it with tags, such as and etc, that surround teh text that you want to 'mark up'.
Title: Re: Visual Basic new line character? [Solved =)]
Post by: Jed on October 16, 2006, 03:57:59 am
On topic: You can also use vbnewline for the same effect.
Off topic: I know the feeling.
Teacher: "Class your assignment is to make a calculator."
Me: "Done. Now what?"
Teacher: "Teach them how."

Little did I know that they had done no work on vb at all. I blame the flu for this.
Title: Re: Visual Basic new line character? [Solved =)]
Post by: AoDC on October 16, 2006, 05:44:44 am
On topic: You can also use vbnewline for the same effect.
Off topic: I know the feeling.
Teacher: "Class your assignment is to make a calculator."
Me: "Done. Now what?"
Teacher: "Teach them how."

Little did I know that they had done no work on vb at all. I blame the flu for this.
Cool, but my code is already done :P. And thank god I am not alone.

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved