SA-MP Forums Archive
Visual Basic - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Visual Basic (/showthread.php?tid=313955)



Visual Basic - SnG.Scot_MisCuDI - 28.01.2012

Hey im making a simple program in Visual Basics that will soon be released. Im having some troubles though.
My problem is, im trying to make it show the 'code' when you click generate.
Well, its working, but its only showing one line. Im not sure why it only shows one line...
Maybe im missing something at the end of the line?
Heres part of the code

Код:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        TextBox14.Text = "if(strcmp(cmdtext," + TextBox1.Text + ") == 0)"
        TextBox14.Text = "SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"
    End Sub
But when i click Button5 (generate) i get only this line in the TextBox14:
Код:
TextBox14.Text = "SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"
Any help?


Re: Visual Basic - FarSe. - 28.01.2012

Код:
        TextBox14.Text = "if(strcmp(cmdtext," + TextBox1.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");\r\n"
        TextBox14.Text += "SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"
or
Код:
        TextBox14.Text = "if(strcmp(cmdtext," + TextBox1.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");\r\n"
        TextBox14.Text &= "SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"



Re: Visual Basic - SnG.Scot_MisCuDI - 28.01.2012

It shows it both now,, but its on the same line
Код:
if(strcmp(cmdtext,,,);\r\nSetPlayerPos(playerid,,,);
is how it shows
I want it to show:
Код:
if(strcmp(cmdtext,,,);
SetPlayerPos(playerid,,,);
(ignore the ,,, numbers and words eventually will go there )


Re: Visual Basic - FarSe. - 28.01.2012

http://lmgtfy.com/?q=vb+add+newline+to+string
Put vbCrLf in the end
pawn Код:
TextBox14.Text = "if(strcmp(cmdtext," + TextBox1.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"+vbCrLf
        TextBox14.Text &= "SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");"



Re: Visual Basic - SnG.Scot_MisCuDI - 28.01.2012

Omg thank you. (and i was looking on ****** :P)
+rep
Much thanks.


Re: Visual Basic - SnG.Scot_MisCuDI - 28.01.2012

How can i make it so if radiobutton1 and checkbox1 is checked it shows this code
Код:
 If RadioButton2.Checked And CheckBox2.Checked = True Then
            TextBox14.Text = "CMD:" + TextBox1.Text + "(playerid, params[])" + vbCrLf
            TextBox14.Text &= "     {" + vbCrLf
            TextBox14.Text &= "     SetVehPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");" + vbCrLf
            TextBox14.Text &= "     SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");" + vbCrLf
            TextBox14.Text &= "     return 1;" + vbCrLf
            TextBox14.Text &= "     }" + vbCrLf
BUT if only radiobutton1 is checked it shows
Код:
 ElseIf RadioButton2.Checked = True And CheckBox2.Checked = False Then
            TextBox14.Text = "CMD:" + TextBox1.Text + "(playerid, params[])" + vbCrLf
            TextBox14.Text &= "     {" + vbCrLf
            TextBox14.Text &= "     SetPlayerPos(playerid," + TextBox10.Text + "," + TextBox11.Text + "," + TextBox12.Text + ");" + vbCrLf
            TextBox14.Text &= "     return 1;" + vbCrLf
            TextBox14.Text &= "     }" + vbCrLf
Becuase right now it shows Radiobutton1 twice