Author Topic: Is anyone familiar with visual basic? I need help  (Read 807 times)

Offline ImADot

  • Platinum Member
  • ******
  • Posts: 6215
Re: Is anyone familiar with visual basic? I need help
« Reply #30 on: April 03, 2014, 07:58:56 PM »
This looks great but it is definitely way more advanced than we have gotten so far in this class. I am going to get working on this code tonight or tomorrow night and I'll post what I can come up to get you guys' input/advise. I really do appreciate all of you guys' help. I bet I will learn more in this thread than in this class. 

Yeah, I'm a big fan of using the form to allow me to do less coding work.  :old:
If you need more explanation of how and why my last code chunk does what it does, let me know.
I feel your pain about the class...many "teachers" either barely know the subject or just don't know how to transfer their knowledge.
Good luck with the project!
 :salute
My Current Rig:
GigaByte GA-X99-UD4 Mobo w/ 16Gb RAM
Intel i7 5820k, Win7 64-bit
NVidia GTX 970 4Gb ACX 2.0
Track IR, CH Fighterstick, CH Pro Throttle, CH Pro Pedals

Offline SilverZ06

  • Silver Member
  • ****
  • Posts: 1727
Re: Is anyone familiar with visual basic? I need help
« Reply #31 on: April 07, 2014, 10:29:09 PM »
OK, I finally got a chance to sit down tonight and work on this. I will be working on it all day tomorrow as well. Since I am fairly new at this I like to see everything that is happening so my code to populate my array is very redundant. I have added an "Enter Card" button to all five cards so that each button click populates a segment of the array. This is not exactly end-user friendly at the moment but it helps me to visualize what is going on. Here is my form and my code so far. I am only including the code for the first button click as the remaining 4 are identical except for changing out the numbers of the buttons.

FORM:



Quote
Option Strict On
Option Explicit On
Option Infer On




Public Class Form1
    Dim hand(3, 12) As Integer







    Private Sub btnCard1_Click(sender As Object, e As EventArgs) Handles btnCard1.Click
        Dim suit As String
        Dim faceValue As Integer

        suit = txtCard1Suit.Text.ToUpper
        faceValue = CInt(mtbCard1.Text) - 1

        If (faceValue < 1) Or (faceValue > 13) Then
            MessageBox.Show("Invalid Denomination for Card 1. Please re-enter the denomination.", "ERROR")
        End if

            Select Case suit
                Case "C"
                    hand(0, faceValue) = 1
                Case "D"
                    hand(1, faceValue) = 1
                Case "H"
                    hand(2, faceValue) = 1
                Case "S"
                    hand(3, faceValue) = 1
                Case Else
                    MessageBox.Show("Invalid value for card 1 suit. Please re-enter the suit.", "ERROR")

        End Select



    End Sub


So now I believe I have the array correctly populated. Now I need to figure out how to make functions and pass the array to them to check against a hand. Does anyone see anything wrong with my code so far or have any suggestions for improvement? Thanks for all you guys' help again  :salute :cheers:

Offline ebfd11

  • Platinum Member
  • ******
  • Posts: 4151
      • [b]POTW[/b]
Re: Is anyone familiar with visual basic? I need help
« Reply #32 on: April 07, 2014, 10:43:58 PM »
After reading this thread Lawndarts brain hurt,,,,, uggg I finally realized I'm a dummy when it comes to internal but when it comes to builing them, I is tha Geek.

LaneDart
PIGS ON THE WING 3RD WING

InGame id: LawnDart
RIP Skullman Potzie and BentNail