hi there... i am very new (and i mean VERY NEW at visual basic) programming, lets just say this is my 5th hour (and counting) learning programming, i googled since hour 1, i even read almost all i can read while im installing visual studio 2010 coz i really want to learn this programming language coz somebody said that this is an easy language to learn coz of GUI.. so please be easy on me on this one
i got a program here with 10 textboxes and 3 buttons, and i want to save every text on that textboxes in a file (myfile.txt)..
i did that by using this commands
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim sb As New StringBuilder()
Dim user As String = Environment.UserName
sb.Append(TextBox1.Text)
sb.Append(TextBox2.Text)
sb.Append(TextBox3.Text & vbCrLf)
sb.Append(TextBox4.Text & vbCrLf)
sb.Append(TextBox5.Text & vbCrLf)
File.WriteAllText("c:\account\myfile.txt", sb.ToString())
MessageBox.Show("File Saved")
OR
Dim output As String = ""
output = TextBox1.Text & Environment.NewLine & TextBox2.Text & Environment.NewLine & TextBox3.Text & Environment.NewLine
My.Computer.FileSystem.WriteAllText("C:/account/myfile.txt", output, True)
MessageBox.Show("File Saved")
all of that is working, i know everyone of them is doing the same darn thing but i wanted to learn every possible approach on this program
now what i dont know is how to save that text in a format..
1. i want the textbox1 to be only 6 digits, i already edited the maxlength property of the textbox to 6. now the problem is if i input 3 character e.g. "aaa" and i want the remaining length to be automatically filled with a "space"
so it will become "aaa " (with 3 spaces after the last "a")
2. then i want the textbox2 to do the same thing AFTER the textbox1 and with space also..
*darn english is not my first language*
can anyone help me please?