dcsimg
Results 1 to 8 of 8

Thread: How to vb net sentence selector in textbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    4

    How to vb net sentence selector in textbox

    Hi friends, my homework is to select certain sentences.
    certain sentences = U D R L
    sample picture = Name:  Ekran Al?nt?s?.jpg
Views: 153
Size:  16.0 KB

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    4

    Re: How to vb net sentence selector in textbox

    How can I do it

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,072

    Re: How to vb net sentence selector in textbox

    Do what? You haven't actually asked a coherent question. Please provide a FULL and CLEAR explanation of the problem. If I had to guess, I'd say that you wanted to pull out all occurrences of those four letters followed by numbers, but that has nothing to do with sentences so I have my doubts. Assume that we have no existing knowledge of your problem (because we don't) and provide ALL the relevant information.

    That said, if this is a homework assignment then simply dumping it here and asking us how to do it is cheating. It's up to you to do your own homework. We can certainly help with specific issues you encounter along the way but if you have made no attempt, which appears to be the case, then you can't possibly have encountered a specific issue.

    As with any problem, the first thing to do is to forget that it's a programming problem. Think about how you would do it manually. Then think about how you would write out a detailed list of instructions for someone with no prior knowledge to do it manually. Then... write down that list of instructions. That is your algorithm. Only then should you consider writing any code and the code you write needs to implement your algorithm exactly. If your code doesn't work, you can then debug it and see exactly where its behaviour deviates from your algorithm. If it follows the algorithm exactly but doesn't produce the expected results then there's something wrong with your algorithm, so you need to review that. If you still can't find where the issue is, THEN you should post here, providing details of what you're trying to achieve, how you're trying to achieve it (algorithm and relevant code) and what happens when you try (error message(s) and specific unexpected behaviour). We can then help you with that specific issue.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    4

    Re: How to vb net sentence selector in textbox

    thank you for the information. fair enough,I will do what they say.

  5. #5
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    911

    Re: How to vb net sentence selector in textbox

    it looks like hes trying to pull out matches based from the textbox on the right of his picture.

    in a simple loop you would have a list/array of character groups to find and your text.

    you would loop each character in the text and match it with each character in the list of characters to find, once you hit a match you create another loop to try and match the rest of the item in the list of characters to find, if no match is found you then just continue on your first loop..

    thats the basic logic behind it good luck
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    4

    Re: How to vb net sentence selector in textbox

    I wrote the code
    Code:
    Dim x1 As Integer, x2 As Integer, x3 As Integer, x4 As Integer, x5 As Integer, x6, x7, x8, x9, x10 As Integer
            Dim y1 As String, y2 As String, y3, y4, y5, y6 As String
            y1 = TextBox1.Text
            x1 = InStr(1, y1, "U")
            x3 = InStr(1, y1, "L")
            x4 = InStr(1, y1, "D")
            x5 = InStr(1, y1, "W")
            If x3 > x1 Then
                x2 = Len(y1)
                y2 = y1.Remove(x1, x3 - x1 - 1)
                x6 = InStr(1, y2, "U")
                y3 = y2.Remove(0, x6 - 1)
                x7 = InStr(1, y3, "L")
                x8 = Len(y3)
                y4 = y3.Remove(x7, x8 - 2)
                TextBox2.Text = y4
            End If
    Name:  pic2.PNG
Views: 37
Size:  6.0 KB
    I find U between L delete but How to U and L next count not delete ?

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,072

    Re: How to vb net sentence selector in textbox

    Quote Originally Posted by omwe View Post
    I find U between L delete but How to U and L next count not delete ?
    I don't understand what that means and your code is extremely terse and with meaningless variable names and no comments so I'm not prepared to take the time to work out what it's actually doing when you already know and could have made it clear.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    911

    Re: How to vb net sentence selector in textbox

    i must agree with jmcilhinney here, the last code you posted just doesnt make sense when considering your first post...

    to be honest in the last post the code just doesnt make sense at all, its not clear what your trying to do.


    if your trying to find certain text within another text then what your doing is completely wrong...... from your first post this is what you wanted....

    you need to clarify exactly what your trying to do..
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width