Re: TextBox Alignment Help
Welcome to the Forums.
You can use some string functions like Replace, Mid$, Instr, etc.
What code have you written to ewrite out the strings/tabs. Can you post it?
1 Attachment(s)
Re: TextBox Alignment Help
I play guitar too so I know what you're talking about.
What you have to do is replace a "-" with whatever number they're entering.
I attached a small example. only takes a few lines of code
Re: TextBox Alignment Help
Well, since I'm not sure what I am doing with visual basic (I have just started to take a computer programming class this trimester) and my teacher teaches me nothing, I don't know what ewrite means. However, what I am doing is putting my input directly into the text box with the command button click.
If a.Value = True Then
txtWrite.Text = "---" & vbCrLf & "-2-" & vbCrLf & "-2-" & vbCrLf & "-2-" & vbCrLf & "-0-" & vbCrLf & "---"
End If
The Input looks like this in the text box
---
-2-
-2-
-2-
-0-
---
Re: TextBox Alignment Help
DigiRev,
What does this code do hahaha
Re: TextBox Alignment Help
It just replaces a "-" with the number entered into the textbox...
Did you run the code to see what it does?
Re: TextBox Alignment Help
right now i'm trying this code in my form. The form i zipped from you does nothing when i start it up. What do i dimension or declare KeyAscii as?
Re: TextBox Alignment Help
The first thing you need to do in your project is, fill the textbox you're using with the empty tab: ie:
----------
----------
----------
----------
----------
----------
Then, with your form open, double-click the textbox to bring up the code window. Make your textbox's KeyPress() sub look like this:
VB Code:
Private Sub txtTab_KeyPress(KeyAscii As Integer)
Dim lonStart As Long, strText As String
lonStart = txtTab.SelStart
strText = txtTab.Text
Mid$(strText, lonStart + 1, 1) = Chr$(KeyAscii)
txtTab.Text = strText
txtTab.SelStart = lonStart + 1
KeyAscii = 0
End Sub
Now when the person enters a number into your tab textbox, it will keep the tab lines formatted
Re: TextBox Alignment Help
Oh I see, the problem is that I'm trying to make a program that will make tabbing much easier. It takes alot of time and effort to type in the individual numbers for the chords and such. So what I am trying to do is make buttons where you can select chords, powerchords, bar chords, and all that good stuff and just put them into one text box. Then you can push another command button and it will apear in the top text box. My problem is trying to put two sets of chords or whatever in the top text box because it ends up looking like this.
---
-2-
-2-
-2-
-0-
------
-2-
-2-
-2-
-0-
---
1 Attachment(s)
Re: TextBox Alignment Help
Ok, this example is a bit more complicated, so I'm not sure if you'll understand the code completely, but it does what you want
Re: TextBox Alignment Help
When I run it and try to add D Major it says "runtime error 9 subscript out of range"
for Mid$(strLines(StringNumber - 1), StartPos, 1) = NoteValue
Re: TextBox Alignment Help
Do you want me to send you what I have of the program so far so you can take a look at it?
Re: TextBox Alignment Help
Did you change any of the code?
Because it works fine for me with no errors... :confused:
Yeah, send me your project, that would make it easier
Re: TextBox Alignment Help
Ok, it's very, very simple stuff because i'm a total vb newb how did you zipit onto here? Sorry all I can ask is for your patients, i know little about computers. :bigyello:
Re: TextBox Alignment Help
Under the box that you type your message in there's a button called "Manage Attachments" click it, and a new window will pop up. Click the "Browse" button, select your zip file, and click "Upload". It will tell you when the upload is finished, then close the window and post your message...
You will need Winzip to zip your project if you don't have it already...just zip the whole folder containing your project's files
www.Winzip.com
Re: TextBox Alignment Help
You can download a free version of WinZip from here
http://www.winzip.com/
Ok, it's an evaluation copy, but it works.
Open WinZip, by selecting all the files in your project, right click, and select WinZip -> Add to Zip file. Give it a name, and the files will be compressed into one Zip file.
Reply to a message, type in some text, and scroll down to the Manage Attachments button. Click BROWSE, and double-click on the .zip file.
Then click ATTACH.
When you SUBMIT the reply, the file will be included in the post.
I see now that it's a 21-day trial period. I think it just nags you after that time has elapsed. I have a registered version, so I'm not sure.
1 Attachment(s)
Re: TextBox Alignment Help
I'll just send the whole thing as a form. Hope it works :)
Re: TextBox Alignment Help
Well, the way you are doing it makes it kinda hard. You should start out with an empty tab and just fill in the spaces as they add chords
I gotta go now, but when I get off work tomorrow I'll try and help you sort this thing out..
Re: TextBox Alignment Help
Ok, thanks for all your help. Have fun at work while I stay home on Spring Break :bigyello:
Take it Easy, Keep it real