Results 1 to 30 of 30

Thread: help

  1. #1

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Arrow help

    Is there a way to replace a hyphon line ( - ) with a number?

    Also is there a way to do this and skip a hyphon?

    v v v
    ----------
    Nick

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: help

    Do you want to replace all the hyphens with a number? In that case you can look at the Replace function. Otherwise, you'll need to use the InStr and Mid functions...

    Can you give us a sample string?


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    1.) strFretNumber, 3.) strStringNumber

    3 --------------
    3 --------------
    3 --------------
    3 --------------
    3 --------------
    3 --------------
    1

    Numbers are where the string applies to.
    Nick

  4. #4

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    Oh the 1st string should be the spaces between the hyphons. Don't know why it went to the left justification.
    Nick

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: help

    Try putting the text in [code] tags, I think it keeps the aligning then...


    Has someone helped you? Then you can Rate their helpful post.

  6. #6

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    How does that help replace the hyphon with a number? I think I need to see the code.
    Nick

  7. #7
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: help

    I meant to use the code tags to show us what you mean with the spaces.. Since the alignment isn't right...

    Code:
          <-spaces in front!


    Has someone helped you? Then you can Rate their helpful post.

  8. #8

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    How is the spacing not right? It is guitar music so I just just to replace the hyphons with numbers where the user wants the notes
    Nick

  9. #9
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: help

    So you want to change "-------" into "-1-2-3-"?

    Start with a line of "-", then:
    String = Replace(String, "--", "-" & Number)

    You could also start with an empty string, then:
    String = String & "-" & Number
    This doesn't limit the number of numbers to the length of the "-" string.

    Then put it in a loop that fetches the next number every time it loops until you're out of numbers.

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: help

    Try This

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     Dim strString As String
    4.     Dim AnArray(2) As Integer
    5.    
    6.     strString = "--------"
    7.    
    8.     AnArray(0) = 2
    9.     AnArray(1) = 4
    10.     AnArray(2) = 5
    11.    
    12.     ReplaceHyphens strString, AnArray
    13.     MsgBox strString
    14.    
    15. End Sub
    16.  
    17. Public Sub ReplaceHyphens(ByRef TheString As String, Positions() As Integer)
    18.  
    19.     Dim intIndex As Integer
    20.    
    21.     For intIndex = 0 To UBound(Positions)
    22.         TheString = Left$(TheString, Positions(intIndex) - 1) _
    23.                   & Positions(intIndex) _
    24.                   & Right$(TheString, Len(TheString) - Positions(intIndex))
    25.     Next
    26.    
    27. End Sub

  11. #11
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: help

    Quote Originally Posted by nickTHEguitarist
    Oh the 1st string should be the spaces between the hyphons. Don't know why it went to the left justification.
    You said here that the strings got messed up... That's why I was suggesting it...


    Has someone helped you? Then you can Rate their helpful post.

  12. #12

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    Ok, I understand how the replace part works, but is there a way you can do this in different lines along with different spaces?
    Nick

  13. #13
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: help

    I think whatever you end up with, you shoud start off with something that you will be able to print out. You are going to have to decide how many tabs will go accross one page, whether you are going to include any other staffs for melody or bass/drums?
    That's why I suggest that you start with a rich text box. You could even design a sheet in Word, including the staffs, measure, chord tabs, you name it. Just save it as an RTF file. Then you can load it into the program, and use the program to print over the RTF file.

    You're going to have to come up with a way to identify each string position in each tab. What I did in my rtb was to place [1] - [45] in the positions that I wanted to place my data, and then used find and replace to replace them with values from my program.

    You might even want to scan something in for starters.
    Attached Files Attached Files

  14. #14

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    That is a good idea for the music sheet, but I think I just need to know how to replace the hyphons with numbers(which i know now) and how to do that in different lines. The rest I can handle because, and no offense to you, I probably know a bit more on guitars than you might. I don't mean to sound cocky, and you may know more.
    Nick

  15. #15
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: help

    Well, i thought you were doing sheet music. if you just want a few tabs on a form, and you don't care about printing them, then go with whatever works. When you open the project it wil talk to your printer, and scale the width of the screen to half of the printer's page width. You don't have to use it, though.

    btw - I've had a Roland GR-70 MIDI guitar that I loan out. I play keyboards.
    MIDI allows the sequencer to print out whatever you play.
    Last edited by dglienna; Apr 8th, 2005 at 06:17 PM.

  16. #16

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    A print part of it would be nice. I am doing sheet music but I was just talkin about the other bass and melody. This is mainly for guitar tabbing. Right now I'm trying to figure out how to take a blank tab and have it so the user can place chords and power chords and all that good stuff inside the blank tab. Any suggestions?
    Nick

  17. #17
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: help

    Make an array of strings, one element for each (guitar)string.
    Then use the index to pick the right line:
    Dim GuitarString(1-6) As String
    DoSomethingWith (String(1))

    I know computerstrings but not guitarstrings.
    How do these tabs work?

    Each line represents a guitarstring?
    Going from left to right represents time?
    What do the numbers on the line represent? Where you put your finger on the neck when you strike the string?

    If I put a tab on one string, can I still put a tab above it on another string? (as in A)
    Or should I puta "--" on the other strings and put the tab for the other string a step to the right? (as in B)

    In that case it would be better to start with empty strings and build them up as you add tabs.
    You would append the tab to the proper string and "--" to the others, then do the next tab.

    How do you obtain the tabdata?
    Is it written on disk?

    Code:
         A          B          
    -1-------- -1-------- 
    -2-------- ---2------ 
    -3-------- -----3---- 
    ---------- ---------- 
    ---------- ---------- 
    ---------- ----------

  18. #18
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: help

    The wingdings have some pretty cool characters.

    Here is a sample.
    Attached Images Attached Images  

  19. #19

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    Tabs a very simple. The six lines of hyphons represent each string on the guitar. the top line is the top string on the guitar, the bottom is the bottom. The numbers represents where you place your fingers on the fret board. ---5--- would be the fifth fret from the right end if you're facing the guitar.

    When you made that code, jeroen, did you use the arrays and a (vb) string for each of the (guitar) strings? This is what I'm trying to do but I'm not sure how to put the data into the text box.

    I tried...
    Code:
    txtTabWrite.Text = strStringHE & strStringB & strStringG & strStringD & strStringA & strStringLE
    Please Help Me I'm a guitarist not a Computer-ist
    Nick

  20. #20
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: help

    Does this do what you want?
    VB Code:
    1. 'add:
    2. 'form1
    3. 'command1
    4. 'text1 multiline and horizontal scrollbar
    5. 'label2
    6. 'text2 for string
    7. 'label3
    8. 'text3 for fret
    9. 'group labels and textboxes by number
    10.  
    11. Private GuitarString(6) As String
    12.  
    13. Private Sub Command1_Click()
    14.   AddTab CInt(Text2.Text), CInt(Text3.Text)
    15.   DisplayStrings
    16. End Sub
    17.  
    18. Private Sub Form_Load()
    19. '  Text1.MultiLine = True
    20.   Text1.Text = ""
    21. '  Text1.ScrollBars = 1
    22.   Text2.Text = ""
    23.   Text3.Text = ""
    24.   Label2.Caption = "string"
    25.   Label3.Caption = "fret"
    26. End Sub
    27.  
    28. Private Sub DisplayStrings()
    29.   Text1.Text = GuitarString(1) & vbCrLf & GuitarString(2) & vbCrLf & _
    30.                GuitarString(3) & vbCrLf & GuitarString(4) & vbCrLf & _
    31.                GuitarString(5) & vbCrLf & GuitarString(6)
    32. End Sub
    33.  
    34. Private Sub AddTab(Str As Integer, Pos As Integer)
    35. Dim Txt As String
    36.  
    37.   For i = 1 To 6
    38.     If i = Str Then Txt = "_" & Pos Else Txt = "__"
    39.     GuitarString(i) = GuitarString(i) & Txt
    40.   Next i
    41. End Sub
    To write to multiple lines you need VbCrLf to add a return.

  21. #21

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Arrow Re: help

    Ok no one wants to seem to help me. I'm fine with that I wouldn't want to deal with me either. I'm going to give up on this project for now and try to build my way up to it with simpler things.
    Nick

  22. #22
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: help

    I don't mind helping you.
    Is my code of any use?

  23. #23

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    Oh jeroen I didn't see your post.
    Nick

  24. #24

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    thanks for your help jeroen, but alot of this stuff is really too complicated for me. I just need something so that I can do this. I already have command buttons and text boxes, so it isnt much help when you have to create other ones.

    Here is my form, you can take a look at it, all I need is a way to put in numbers in the hyphon lines. I need the numbers to be put anywhere in the hyphon line with it being a number of the user's choice.

    Tinker around with it if you don't mind
    Nick

  25. #25

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    Oops, forgot to add the form
    Attached Files Attached Files
    Nick

  26. #26
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: help

    I wouldn't know where to begin to help, as I'm not a guitarist, but know a great deal about music. I've suggestied a few things that I thought would help. This has to be done the way that you want it. You haven't said if everything is one neck of the guitar, or a lot of tabs next to each other.

  27. #27

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    That's ok I've given up on this project...



    Take it easy, keep it real.
    Nick

  28. #28
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: help

    Hey Nick -
    Don't give up on this; it is an interesting project! I play(ed) guitar and I am familiar with tabs (although at this point I'm chained to my desk coding while my son and his buddies have their way with my instruments

    I was looking at your form and then I pulled out an old music book ("The Best of AC/DC" to be exact) and started thinking about this ...

    Here's an idea: rather than use a multi-line textbox for the user interface, consider a grid (MSFlexGrid). You could dimension the grid as 6 rows by however many columns, where the rows represent the guitar strings. When the user clicks in the cell of the grid, they could enter the fret number; or if they right-click, a popup menu with various options could appear (enter barre chord "A", etc.)

    You could actually have a control array of such grids so you could fit six or so of these on a form. You could have "back" and "next" buttons so that the user can move forward to continue entering the tab for the song, or move back to review what has already been entered.

    When the user is done, you could save their entries to a text file like you were speaking of. You could have an option to load back in a previously saved file.

    Boy, this is turning into a major project, isn't it? And I know you are new to VB so that makes it even more challenging. I would encourage you keep this project alive (even if just on the back burner) and work on it over time. If I get the time (which unfortunately is tight) I'll try to whip up some kind of example.
    "It's cold gin time again ..."

    Check out my website here.

  29. #29

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: help

    I guess that's a good idea. But all I know how to do is command push buttons and x.visible = true lol. It'll be tough seeing how I have no clue what a flex grid is. But i'll give it a shot I probably have much more time on my hands than you do.
    Nick

  30. #30
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: help

    I understand where you're coming from, and working up the solution I suggested is not a trivial matter. As I suggested, keep it on the back burner; meanwhile I'll see what I can do.

    FYI, many controls beyond what you find in the regular VB toolbox (including the FlexGrid) are accessed through Project -> Components - you check off the desired control and once you click OK, that control will be added to your toolbox. (Note - you have to know what you are looking for, because a lot of junk not usable by VB may also appear in that Components list.) The FlexGrid appears as "Microsoft FlexGrid Control 6.0 (SP3)".
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width