Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    48
    Thanks
    1
    Thanked 0 Times in 0 Posts

    VB Arrays through function that is larger than input

    Hello,
    I have an function that has an array, when a user inputs a number it catches the array through the function and gets the pricing back.

    Although when the user inputs something larger than 4 I would like it to display the same contents as the 4th column...It's auto populated to:

    Code:
        0     1       2     3       4
    1   #     #       #     #       #
    2   #     #       #     #       #
    3   #     #       #     #       #
    4  24     32      34    37      42
    Lets say a user inputs 0 for the row and 6 for the column.
    Is there a way to display the same contents as 4?


    Sorry if i don't explain this right. New to programming...

    Thank you.

  • #2
    Regular Coder
    Join Date
    Dec 2007
    Posts
    137
    Thanks
    1
    Thanked 21 Times in 21 Posts
    Code:
    Dim userInputCol As Integer = 6
    Dim userInputRow As Integer = 0
    
    If (userInputCol >= 6) AndAlso (userInputRow = 0) Then
    	Console.WriteLine("col and row is 6 and 0, so show column 4 contents")
    Else
    	Console.WriteLine("show the column and row")
    End If
    That should give you the logic to do it. Replace the Console.WriteLine lines with your array finding code.

    edit: fixed a typo. I had "4" instead of "6" originally.


  •  

    Posting Permissions

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