[VB.NET] Add one higher value than what's in the textbox menu

Shout-Out

User Tag List

Results 1 to 14 of 14
  1. #1
    Ebonesser's Avatar Member
    Reputation
    33
    Join Date
    Mar 2009
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [VB.NET] Add one higher value than what's in the textbox

    So I got four textboxes and I want every "data()" to get one higher (+1) then the data that is in that textbox without having to write everything for hand as that would be A LOT of text and would be finite :/



    Here's the code:

    Code:
            If TextBox1.Text = data(0) Then
                TextBox1.Text = data(1)
            End If
            If TextBox1.Text = data(1) Then
                TextBox1.Text = data(2)
            End If
            If TextBox1.Text = data(3) Then
                TextBox1.Text = data(4)
            End If
            If TextBox2.Text = data(1) Then
                TextBox2.Text = data(2)
            End If
            If TextBox2.Text = data(2) Then
                TextBox2.Text = data(3)
            End If
            If TextBox2.Text = data(3) Then
                TextBox2.Text = data(4)
            End If
            If TextBox3.Text = data(2) Then
                TextBox3.Text = data(3)
            End If
            If TextBox3.Text = data(3) Then
                TextBox3.Text = data(4)
            End If
            If TextBox3.Text = data(4) Then
                TextBox3.Text = data(5)
            End If
            If TextBox4.Text = data(3) Then
                TextBox4.Text = data(4)
            End If
            If TextBox4.Text = data(4) Then
                TextBox4.Text = data(5)
            End If
            If TextBox4.Text = data(5) Then
                TextBox4.Text = data(6)
            End If


    Any help would be appreciated

    [VB.NET] Add one higher value than what's in the textbox
  2. #2
    codehpro's Avatar Member
    Reputation
    1
    Join Date
    Oct 2009
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here you go

    textbox1.text = val(textbox1.text) + 1

  3. #3
    Danne206's Avatar Contributor
    Reputation
    183
    Join Date
    Jan 2008
    Posts
    717
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't have any VB programming knowledge at all, here's some similar php code, should give you an idea if we're thinking of the same.
    I probably got it wrong, but you could do something similar.
    PHP Code:
    <?php
    /*
     * $Means variable, FYI.
     */

    function data($args) {
        
    //Your data function, don't know if it's a VB default.
    }

    function 
    DataIncrease($args) {
        
    $value $args++; //Increase by one
        
    return data($value);
    }

    $textboxes = array('1''2''3''4''5'); //An array with all textboxes in.

    foreach ($textboxes as $id) {
        
    $num "TextBox" $id ".Text"//i.e TextBox1.Text
        
    $increased $id++;
        if(
    $num <= data($id)) /* You obviously use you own num method. */ {
            
    DataIncrease($increased);
        }
    }

    ?>
    If you want an infinite number of form you can use the for.
    Dahnniel [DOT] s [AT] gmail [DOT] com

  4. #4
    stealthy01's Avatar Corporal
    Reputation
    9
    Join Date
    May 2010
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What datatype are the array elements?

  5. #5
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Input.Text = (int.TryParse(Input.Text) + 1).ToString();
    ??


  6. #6
    Bacanze's Avatar Member
    Reputation
    3
    Join Date
    May 2009
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by suicidity View Post
    Code:
    Input.Text = (int.TryParse(Input.Text) + 1).ToString();
    ??
    This

    Also use a switch (think they are called case statements in VB) to avoid the pointless conditional loops.

  7. #7
    tehchrono's Avatar Member
    Reputation
    2
    Join Date
    Jan 2007
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if isNumeric(input.text) then
    input.text = csng(input.text)+1
    end if

  8. #8
    Ebonesser's Avatar Member
    Reputation
    33
    Join Date
    Mar 2009
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry that I haven't replied

    The arrays?

    Code:
            Dim data As String()
            data = TextBox1.Text.Split("&")

  9. #9
    d3rrial's Avatar Contributor Authenticator enabled
    Reputation
    127
    Join Date
    Apr 2010
    Posts
    527
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everything here is all wrong. Won't work since you make the values + 1. But ebon wants us to make the value shift through the registers. (U no what I mean, like A=1
    Reg1
    Reg2
    Reg3
    Reg4

    And then shift the A=1 through all the registers.

    So my answer is: Nope, won't work since you cannot (AFAIK) make the program create variables for you. You cannot make vb Code saying like 'writeline: dim register"Counter+1"'

  10. #10
    Ebonesser's Avatar Member
    Reputation
    33
    Join Date
    Mar 2009
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks for the help anyways

  11. #11
    teh_bee's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
            ' array of integers
            Dim data() As Integer = {1, 2, 3, 4, 5}
    
            If TextBox1.Text = data(0).ToString() Then
                TextBox1.Text = (data(0) + 1).ToString()
            End If
            If TextBox2.Text = data(1).ToString() Then
                TextBox2.Text = (data(1) + 1).ToString()
            End If
            If TextBox2.Text = data(2).ToString() Then
                TextBox2.Text = (data(2) + 1).ToString()
            End If
            If TextBox2.Text = data(3).ToString() Then
                TextBox2.Text = (data(3) + 1).ToString()
            End If
            If TextBox2.Text = data(4).ToString() Then
                TextBox2.Text = (data(4) + 1).ToString()
            End If

  12. #12
    zezenana's Avatar Member
    Reputation
    2
    Join Date
    Jan 2007
    Posts
    6
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dude use case's
    98% of teens revolve their minds around rap. If you're part of the 2% who stuck with rock, put this in your signature.

  13. #13
    Namor's Avatar Active Member
    Reputation
    27
    Join Date
    Jul 2008
    Posts
    311
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite understand what you're trying to do, but I could indeed be of some help.
    explain pl0x.

    Editable signature, at last!

  14. #14
    Ebonesser's Avatar Member
    Reputation
    33
    Join Date
    Mar 2009
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Replied 4 weeks ago? jezz... hope you still checking this thread out
    Well this is my module where "data()" comes from:

    Code:
    Module Module1
        Sub data()
            Dim data As String()
            data = Form1.TextBox1.Text.Split("&")
    
            Try
                Form1.TextBox2.Text = data(0)
                Form1.TextBox3.Text = data(0)
                Form1.TextBox4.Text = data(1)
                Form1.TextBox5.Text = data(2)
                Form1.TextBox6.Text = data(3)
    
            Catch ex As Exception
            End Try
        End Sub
    End Module
    It split's the text in TextBox1.Text at every "&" into data(0,1,2,3 etc.). Form1.TextBox2.Text is a bigg textbox and the others are small ones beneath it.

    I tried this but it didn't work as I wanted it to :/ :


    Code:
            Dim data As String()
            Static i As Byte
            i = 1 + i
            data = TextBox1.Text.Split("&")
    
            If data(IsNumeric(TextBox3.Text)) Then
                TextBox3.Text = data(IsNumeric(TextBox3.Text)) + 1
            End If
    
            If TextBox3.Text = data(data.Count - data.Count + 1) Then
                Try
                    TextBox3.Text = data(data.Count - data.Count + 2)
                Catch ex As Exception
                    Try
                        TextBox3.Text = data(data.Count - data.Count + 1)
                    Catch
                        TextBox3.Text = ""
                    End Try
                End Try
            End If
    
            If TextBox4.Text = data(data.Count - data.Count + 1) Then
                Try
                    TextBox4.Text = data(data.Count - data.Count + 2)
                Catch ex As Exception
                    Try
                        TextBox4.Text = data(data.Count - data.Count + 1)
                    Catch
                        TextBox4.Text = ""
                    End Try
                End Try
            End If
    
            If TextBox5.Text = data(data.Count - data.Count + 2) Then
                Try
                    TextBox5.Text = data(data.Count - data.Count + 3)
                Catch ex As Exception
                    Try
                        TextBox5.Text = data(data.Count - data.Count + 2)
                    Catch
                        TextBox5.Text = ""
                    End Try
                End Try
            End If
    
            If TextBox6.Text = data(data.Count - data.Count + 3) Then
                Try
                    TextBox6.Text = data(data.Count - data.Count + 4)
                Catch ex As Exception
                    Try
                        TextBox6.Text = data(data.Count - data.Count + 3)
                    Catch
                        TextBox6.Text = ""
                    End Try
                End Try
            End If
    I still had to add numbers one after one, even if I didn't know how many data.Count there where I want it to go on until the data.count has reached the max number of data(). So that it would go on continuously :/
    Last edited by Ebonesser; 07-28-2010 at 06:35 AM.

Similar Threads

  1. What db is the best one?
    By pewor in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 10-16-2007, 08:27 AM
  2. Looking back at server exploits, please add ones you remember!
    By volvagia in forum World of Warcraft Exploits
    Replies: 10
    Last Post: 10-15-2007, 12:32 PM
  3. Add One Free Month To Your Account [free]
    By exen12 in forum World of Warcraft Exploits
    Replies: 12
    Last Post: 09-07-2007, 05:39 PM
  4. If One Account gets banned what happens to the other?
    By panda122 in forum World of Warcraft General
    Replies: 2
    Last Post: 07-09-2007, 01:03 AM
All times are GMT -5. The time now is 11:00 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search