A few simple questions. :)

Discussion in 'Programming General' started by WoW Sucks, Nov 1, 2007.

A few simple questions. :)
  1. Unread #1 - Nov 1, 2007 at 8:15 AM
  2. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Well i have to learn vb in school and the teacher i have doesn't know vb (Or any programming language for that matter) so i can't really ask him for help. So why not ask here? :p

    Also, im basically a beginner....so try not to confuse me :)

    Green = Need answering
    Red = Answered.


    Question 1:

    How would make it so, when i choose an item from a combobox, it displays a picturebox?

    Question 2:

    When i use pic1.print, it prints what i want in the picturebox, but only stays there for about 5 seconds. How can i make it stay there permenantly?

    Question 3:

    How would i make it so, when a picturebox is set to visible already, and i click the 'make visible' button, i get a message box saying that it's already set to visible?


    Question 4:

    If i use a textbox to do a kind of log, how do i make it like the RS one, or so it doesn't have a scroll bar, but it keeps moving.


    Question 5:

    Well im trying to make a sort of slideshow, with timers or something like that. Ive got it to load the pictures, but only managed to make it work by using 3 timers, which i don't want, because then it would be a huge source.

    Basically i want the images to be displayed one after another with an interval (using a timer), kind of like an animated gif.

    Code:
    Picture1.Picture = LoadPicture("C:\...")
    
    Picture1.Picture = LoadPicture("C:\...")
    
    Picture1.Picture = LoadPicture("C:\...")
    
    Question 6:

    Basically i need to know how to make a text box so.... when i type something like [red] TEXTHERE [/red] the text is red inside, then stops being red at the [/red] bit. (also, i don't want the bb-code-style-text visible ;) )

    Ill explain more if you don't understand.

    Question 7:

    For this part, i need to learn how to link between forms. For example, if i have a form with webbrowser control on it, and another form with a 'navigate' button on it, how would i make it so, when i click the button, the webbrowser form navigates to text1.text

    Please don't say "webbrowser1.navigate" because that isnt what i want to do, it was just in the example.

    Question 8:

    Well im just curious about how you would do something like downloading a website source code and displaying it in a textbox. Could someone whip up the simplest code for doing it please? (I don't mind if its long, just needs to be simple) and also annotate it. That would be a great help please.

    Question 9:

    Could someone give me some simple code on how to save text files please? and again, annotate it. Thanks :)

    Question 10:

    How would i make it so, when i put some text in a textbox and click a button, it outputs a chosen word/number (from the first textbox) into another textbox.

    Question 11:

    I was thinking about making my own highscores lookup, but in a long-winded-easy-to-understand way. I looked at Flaming Idiot's source and i couldn't really understand some parts. Im not going to ask for someone to write the code for me, i want to try to do it myself, but the thing im stuck with is how to get the HTML code with someone's highscores in it. I tried but it always comes back blank. So could someone explain to me how i would recieve the code?

    Thanks.

    Question 12:

    Code:
    If Option1.Value = True Then
    Picture1.Picture = LoadPicture("images\0.jpg")
    End If
    I need to know how to do something like...

    Code:
     If picture1.loadpicture("images\0.jpg") = true then
            msgbox "The picture is visible"
    End if

    ----------------------------------------------------------------------------

    EDIT: Ok this is an update to question 12:

    Im trying to make a tic tac toe game (well that's the American name) and i this is the code im using (yes its probably extremely nooby but i dnt care :))

    Code:
    Edited to shorten the post.
    
    I need to make an if statement that looks to see if images\0.jpg or images\1.jpg has been loaded or not. Because i need to make it so, if you get 3 X's or 3 O's in a row, then it shows a message box.

    To start with i was going to use something like:

    Code:
     
    
    if picture1.picture = "images\0.jpg" and picture2.picture = "images\0.jpg" and  picture3.picture = "images\0.jpg" then
    
         msgbox "You have won"
    end if
    
    I was going to do that for each combination, which would be long winded, but the easiest way for me.

    :)

    Question 13:

    What do i do to make a peice of code that gets looked at ever few seconds?

    for example, im playing tic tac toe, and when i get 3 'X' in a row, it gives me a messagebox saying ive won. How would i make the program keep looking back to that section of code to see if i had won or not.


    Question 14:

    What is a function used for, and what's the difference to a sub


    Question 15:

    Well for my tic tac toe game, i got everything working with the help of you guys but i have a problem. Because im using this code:

    Code:
    Private Sub win()
    If box(1) And box(2) And box(3) = 2 Then
        MsgBox "You Won!", vbExclamation, "Winner"
    
    ElseIf box(3) And box(6) And box(9) = 2 Then
       MsgBox "You Won!", vbExclamation, "Winner"
    
    ElseIf box(1) And box(4) And box(7) = 2 Then
        MsgBox "You Won!", vbExclamation, "Winner"
    
    ElseIf box(7) And box(8) And box(9) = 2 Then
        MsgBox "You Won!", vbExclamation, "Winner"
    
    ElseIf box(1) And box(5) And box(9) = 2 Then
        MsgBox "You Won!", vbExclamation, "Winner"
    
    ElseIf box(2) And box(5) And box(8) = 2 Then
        MsgBox "You Won!", vbExclamation, "Winner"
    
    End If
    
    It displays a message box in the wrong places. So i need a way to make it so, when it uses an if statement, it doesn't use another.

    Ive tried to explain it as best as i can. Sorry if you don't understand it.

    Question 16:

    Ok, im using thise code:

    Code:
    Private Sub again()
    
    Dim again As VbMsgBoxResult
    
    again = MsgBox("Would you like to play again?", vbYesNo, "Play Again?")
    
    Select Case again
        Case vbYes
            Picture1.Picture = " "
            
        Case vbNo
            Unload Me
    End Select
    
    End Sub

    When someone wins it shows a picture box saying 'Winner' then another messagebox shows up with the above code. If you click 'No' it exits the program, then another messagebox shows up, which is used at the start of the program.

    So i need a way to just exit the program fully, and make nothing else show up.

    The second bit of the question is: How do i make the pictureboxes blank if someone clicks the 'Yes' button on the msgbox?
    Picture1.picture = " " doesn't work =/


    Question 17:

    Now that's all sorted out, i have another problem. When i finish the game of tic tac tie/ naughts and crosses it brings up a messagebox asking if i want to play again, i need to be able to start the whole program again when i click yes, otherwise it fucks up.

    Any ideas? :)


    Question 18:

    Just a few small questions.

    1: What is a 'Tag'
    2: Is MsgAns just the same as using 'Dim a as VbMessageboxResult'?
    3: What does 'Me' mean/do?
    4: What is a control?



    Question 19:

    Is it possible to load a text file into a combobox? So each line in the text file becomes an option in the combobox?

    If you think it's too 'advanced' for me, then just say and ill try something different, or post the code if you feel its still beginner. :)

    Question 20:

    How do i use/install Charmeleon buttons? Ive had them for agesss, downloaded off cruels because i might have needed them in the future... so ya.

    :)

    Question 21:

    1: Can someone explain this line in detail please: Open File_Path For Binary Access Read As #lonFF (refer to page 4)
    2: Can someone explain what this means/how to do it: Load CTL file into project(refer to page 4)

    Question 22:

    What's a simple way of doing:

    Code:
    Private Sub Combo1_Click()
        Select Case Combo1.Text
            Case "blablabla":
               text1.text = "blablabla"
        End Select
    End Sub
    I want to be able to do that, but with lots of different 'blablabla' bits.

    Question 23:

    Which bit of this code actually looks through the HTML, and selects each number etc. Could someone annotate it please :)

    Code:
    Private html             As String
    
    
    Private Sub Form_Load()
      Edited to shorten post.
    
    Credits to Jazz for the source.


    Question 24:

    How would i find the string number from some text in a text box. Something like this:

    hello 3 bye e jazz f dave w covey 6 halo 3 jds

    I want to find the 4th string, and print it; So therefore it would print 'Dave', It also has to skip any single characters =)

    Hopefully it wont be that hard =/


    Question 25:

    Ok. Is there a way to make vb know which button you are clicking on?

    For example:

    Code:
     if i click a certain button then
                   msgbox.......
    end if
    Sorry if you don't understand, its hard to explain.


    Question 26:

    Could someone explain why won't this work:

    Code:
     
    Text1.Text = Left(numb, 1 & (Len(numb)))
    
    Text1.Text = Text1.Text + ","
    
    
    i want it to add a "," to the text box each time it loops. At the moment it only adds one at the end.


    Question 27:

    Is it possible to load the contents of a text file into a variant? If so, how would it be done. Thanks.


    Question 28:

    Ok, that works thanks covey, so far i have this and it won't work. =/

    Code:
    Private Sub Command1_Click()
        Dim file As String
        file = LoadFile(App.Path & "\hello.txt")
        
        If InStr(1, hello, file) Then
            Picture1.Print file
        Else: MsgBox file
        
        End If
        
    End Sub
    
    Public Function LoadFile(ByVal strPath As String) As String
        Dim ff As Long
        ff = FreeFile
        LoadFile = Empty
        Open strPath For Input As #ff
            LoadFile = Input(LOF(ff), ff)
        Close #ff
    End Function
    
    I want it to look in the variant and see if there is a certain string/character there.

    Thanks

    Also, what does the LOF but do/mean? thanks.

    Question 29:

    Code:
    While Cap(Index).Caption <> 0
        Cap(Index) = Cap(Index) + 1
        Cap(Index).Caption = Cap(Index).Caption - 1
        
    Wend
    I have 12 buttons on my form all labled Cap and their index's are 1 to 12.

    The problem is with the second line.

    "Cap(Index) = Cap(Index) + 1"

    What i need it to do is... when i click the first button i need it to loop round the while loop and each time incrementing the index by 1.

    For example: The first time it goes round, then index is 1 (First button) the second time it goes round the index it to (Second button) and so on.


    Question 30:

    How do i connect to a website, then get feedback on wheather it connected successfully or not.

    The feedback being a messagebox or something.


    Question 31:

    How can i make a spreadsheet like in excel? I tried using a few componants like DataGrid, but i can't get it to work. It just needs to be a simple manual input grid.


    I think that's it for now.

    Thanks.
     
  3. Unread #2 - Nov 1, 2007 at 8:37 AM
  4. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A few simple questions. :)

    Answer 1
    Code:
    Private Sub Combo1_Click()
        Select Case Combo1.Text
            Case "harro":
                picture1.Visible = True
        End Select
    End Sub
    Answer 2
    Don't quite understand what you mean.

    Answer 3
    Code:
    Private Sub Command1_Click()
        If picture1.Visible = True Then
            MsgBox "picture1 is already visible.", vbInformation, "Picture Visible"
        Else
            picture1.Visible = True
        End If
    End Sub
     
  5. Unread #3 - Nov 1, 2007 at 9:04 AM
  6. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Another question:

    What do i add to this code to make it:

    1. Not display the "Hello there" when the if statement is used.

    2. Actually make the Yes and No buttons do something.

    Code:
    Text1.Text = Text1.Text & "Hello There" & vbCrLf
        If Pic1.Visible = True Then
            MsgBox "You did something wrong.", vbInformation, "Wrong Choice!"
            MsgBox "Would you like to try again?", vbYesNo, "??"
        End if

    If you can't understand it, ill try and simplify it.

    Thanks.
     
  7. Unread #4 - Nov 1, 2007 at 9:09 AM
  8. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A few simple questions. :)

    Code:
    Dim msgOutcome As VbMsgBoxResult
        msgOutcome = MsgBox("Are you learning?", vbQuestion Or vbYesNo, "Well..?")
        Select Case msgOutcome
            Case vbYes
                MsgBox "you choosed yes"
            Case vbNo
                MsgBox "you choosed no"
        End Select
    EDIT:
    answer to your edited above post:
    Code:
        If pic1.Visible = True Then
            Dim msgOutcome As VbMsgBoxResult
            msgOutcome = MsgBox("An error has occurred!" & vbCrLf & "Would you like to try again?", vbExclamation Or vbYesNo, "Error")
            Select Case msgOutcome
                Case vbYes
                    'Yes has been chosen do stuff here
                Case vbNo
                    'No has been chosen do stuff here
            End Select
        Else
            Text1.Text = Text1.Text & "Hello There" & vbCrLf
        End If
     
  9. Unread #5 - Nov 1, 2007 at 9:53 AM
  10. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Thanks, that's all worked out.

    Ill edit the thread if i have anymore questions.

    EDIT: Another question added.
     
  11. Unread #6 - Nov 3, 2007 at 12:50 PM
  12. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Bump, new question added :)
     
  13. Unread #7 - Nov 3, 2007 at 2:45 PM
  14. Slixr
    Joined:
    Nov 2, 2007
    Posts:
    7
    Referrals:
    0
    Sythe Gold:
    0

    Slixr Newcomer

    A few simple questions. :)

    nvm it was answred
     
  15. Unread #8 - Nov 3, 2007 at 11:34 PM
  16. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    A few simple questions. :)

    I think this could work for question 5...

    Code:
    Dim NextPic as Integer
    
    Private Sub Timer1_Timer()
        If NextPic = 0 Then 
            Picture1.Picture = LoadPicture("C:\...")
            NextPic = 1 'Goes to the next Picture
            Exit Sub 'Exits the Timer1 Sub so it doesn't go to the next one straight away.
        End If
        If NextPic = 1 Then 
            Picture1.Picture = LoadPicture("C:\...")
            NextPic = 2 'Goes to the next Picture
            Exit Sub 'Exits the Timer1 Sub so it doesn't go to the next one straight away.
        End If
        If NextPic = 2 Then 
            Picture1.Picture = LoadPicture("C:\...")
            NextPic = 0 'Makes it loop, you could always add more if you needed more pictures.
            Exit Sub 'Exits the Timer1 Sub so it doesn't go to the next one straight away.
        End If
    End Sub
     
  17. Unread #9 - Nov 4, 2007 at 12:00 AM
  18. halojunkie
    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0

    halojunkie Active Member

    A few simple questions. :)

    I think it could be done better by just doing an array of the picture paths, then loading them sequentially. To load the array you could just split a text file into it.
    Something like:

    Code:
    Private Sub Timer1_Timer()
    Dim intPicture, intTotalPics as Integer
    DIm strFileData as String
    Dim strPicPaths() as String
    
    Open App.Path & "/pics.txt" For Input As #1
    Input #1, strFileData
    Close #1
    strPicPaths() = Split(strFileData,"|")
    intTotalPics = strPicPaths(0)
    
    Picture1.Picture = LoadPicture(strPicPath(intPicture)
    intPicture = intPicture + 1
    If intPicture = intTotalPics + 1 Then
    Timer1.Enabled = False
    End If
    End Sub
    
    I realize that this splits the file everytime it loads the next picture and that there is a better way of doing this. No need to point it out.

    For the text File, do something like:
    Code:
    (totalpicture number here)|C:/Pic.jpg|C:/pic2.gif
    
    Etc Etc Etc
     
  19. Unread #10 - Nov 4, 2007 at 7:27 AM
  20. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Thanks alot :)

    I used Darthatron's because it's simpler and easier to understand.
     
  21. Unread #11 - Nov 5, 2007 at 2:54 AM
  22. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    A few simple questions. :)

    I was going for simplicity, since hes new to vb6 and such. =)
     
  23. Unread #12 - Nov 5, 2007 at 11:58 PM
  24. halojunkie
    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0

    halojunkie Active Member

    A few simple questions. :)

    Ok, let me know if you need any help. It would be good for me to teach someone else.
     
  25. Unread #13 - Nov 7, 2007 at 11:48 AM
  26. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Bump New question. :p
     
  27. Unread #14 - Nov 7, 2007 at 12:33 PM
  28. asda123
    Joined:
    May 13, 2007
    Posts:
    415
    Referrals:
    0
    Sythe Gold:
    0

    asda123 Forum Addict
    Banned

    A few simple questions. :)

    Ok the new question, you need to use a rich text box... I've not used it in a while so ill just have to go over it again myself so i don't tell you something wrong. You get the RTBox in the components (Project > Components or CTRL + T), tick it and click apply its called Microsoft Rich Text Box Control i think. I don't know how to do it exactly how you have explained it, i don't think thats possible.
     
  29. Unread #15 - Nov 7, 2007 at 4:25 PM
  30. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    A few simple questions. :)

    A regular textbox could not do it because it can only have one color of text, its Forecolor. I'm not sure if a rich-textbox could do it but it is a possibility. I've never had to use them so can't provide any help with that aspect.
     
  31. Unread #16 - Nov 7, 2007 at 5:49 PM
  32. jdsfighter
    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0

    jdsfighter Forum Addict
    Visual Basic Programmers

    A few simple questions. :)

    It is not possible to do what you want with a text box or a rich text box, or atleast I couldn't do it. You could try to experiment. You need to use selcolor and seltext properties of the richtextbox control.

    As for your other question. Merely say FormName.Controlname.Property
     
  33. Unread #17 - Nov 7, 2007 at 8:03 PM
  34. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    A few simple questions. :)

    Not putting you down, but it is possible.


    You are on the correct track my son.







    Code:
    Option Explicit
    
    Private Sub Command1_Click()
          Dim i            As Integer
          Dim lolercakes() As String
          lolercakes() = Split("[red].[/red].255-[green].[/green].65280-[magenta].[/magenta].16711935-[blue].[/blue].16711680-[yellow].[/yellow].65535", "-")
          For i = 0 To UBound(lolercakes())
                Call HammerTheScrewsIn(RichTextBox1, CStr(Split(lolercakes(i), ".")(0)), CStr(Split(lolercakes(i), ".")(1)), CLng(Split(lolercakes(i), ".")(2)))
          Next i
    End Sub
    
    Function HammerTheScrewsIn(RichTextBox As RichTextBox, Starting As String, Ending As String, Colour As Long)
          Dim pos    As Long
          Dim endpos As Long
          Dim length As Long
          Dim temp   As String
        
          With RichTextBox
                pos = InStr(1, .Text, Starting)
                While pos <> 0
                      endpos = InStr(pos, .Text, Ending) - (Len(Ending) - 1)
                      If endpos <= 0 Then Exit Function
                      .SelStart = pos + (Len(Starting) - 1)
                      .SelLength = Len(Mid(.Text, pos, endpos - pos))
                      .SelColor = Colour
                     pos = InStr(pos, Starting, .Text)
                Wend
                temp = .TextRTF
                temp = Replace(Replace(temp, Starting, ""), Ending, "")
                .TextRTF = temp
          End With
    End Function
    
    Private Sub Form_Load()
          RichTextBox1.Text = "[red]red[/red]" & vbCrLf & "[green]green[/green]" & _
                 vbCrLf & "[magenta]magenta[/magenta]" & vbCrLf & "[blue]blue[/blue]"
    End Sub
    
     
  35. Unread #18 - Nov 8, 2007 at 12:59 AM
  36. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    A few simple questions. :)

    Answer for Question 7:

    Let's say the Navigate button is on form2 and is called cmdNavigate.
    The TextBox is on form2 also and is called txtNavigate.
    And lets say the WebBrowser is on Form1 and is called Web1.

    Put this in the Navigate Buttons Click() Sub.
    Code:
    Private Sub cmdNavigate_Click()
        Form1.Web1.Navigate txtNavigate.Text
    End Sub
    If thats not what you wanted, then I'm lost.

    Putting the "Form1." before the WebBrowser object tells VB that its on Form1, hope this helped.
     
  37. Unread #19 - Nov 8, 2007 at 3:07 AM
  38. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    A few simple questions. :)

    Thanks alot for the help guys :)

    Sorry jazz, but im not going to use that code since its too advanced for me. Thanks anyway.
     
  39. Unread #20 - Nov 8, 2007 at 7:54 AM
  40. jdsfighter
    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0

    jdsfighter Forum Addict
    Visual Basic Programmers

    A few simple questions. :)

    lol I forgot about the selstart and sellength properties. Wow Sucks, here is a fairly easy to understand commenting of Jazz's code.

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
          Dim i            As Integer
          Dim lolercakes() As String
          lolercakes() = Split("[red].[/red].255-[green].[/green].65280-[magenta].[/magenta].16711935-[blue].[/blue].16711680-[yellow].[/yellow].65535", "-") 'Declares all colors and their values
          For i = 0 To UBound(lolercakes()) 'Loops through RichTextBox1 and searches for each color.
                Call HammerTheScrewsIn(RichTextBox1, CStr(Split(lolercakes(i), ".")(0)), CStr(Split(lolercakes(i), ".")(1)), CLng(Split(lolercakes(i), ".")(2)))
          Next i
    End Sub
    
    Function HammerTheScrewsIn(RichTextBox As RichTextBox, Starting As String, Ending As String, Colour As Long)
          Dim pos    As Long
          Dim endpos As Long
          Dim length As Long
          Dim temp   As String
        
          With RichTextBox
                pos = InStr(1, .Text, Starting) 'Gets the position of the first . so it can get the text
                While pos <> 0 'do as long as the . is found
                      endpos = InStr(pos, .Text, Ending) - (Len(Ending) - 1) ' gets the end of the text
                      If endpos <= 0 Then Exit Function
                      .SelStart = pos + (Len(Starting) - 1) 'the place it should start changing color
                      .SelLength = Len(Mid(.Text, pos, endpos - pos)) 'the length of the text to be colored
                      .SelColor = Colour 'the color the text should be
                     pos = InStr(pos, Starting, .Text) 'sets the position at the beginning of the changed text
                Wend
                temp = .TextRTF 'assigns a variable with the formatting of the RichTextBox
                temp = Replace(Replace(temp, Starting, ""), Ending, "") 'replaces the starting and ending denoters with nothing
                .TextRTF = temp 'reassigns everything back to the RichTextBox
          End With
    End Function
    
    Private Sub Form_Load()
          RichTextBox1.Text = "[red]red[/red]" & vbCrLf & "[green]green[/green]" & _
                 vbCrLf & "[magenta]magenta[/magenta]" & vbCrLf & "[blue]blue[/blue]"
    End Sub
     
< echo in C | Need tutor on Programming >

Users viewing this thread
1 guest


 
 
Adblock breaks this site