Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

Adam Wike

@Adam Wike
About
Posts
14
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • animation?
    A Adam Wike

    Alright thanks I'll go look at it right now. I knew there was an easier way..

    Visual Basic graphics question

  • animation?
    A Adam Wike

    Sadly it's for a school project and I have to do it my teachers way...but I'll defiantely look into that stuff for future programs that I do on my own time.

    Visual Basic graphics question

  • animation?
    A Adam Wike

    Please tell me there is a better way to make a pacman like shape move across my form...

    Public Class Form1
    Dim formSurface As Graphics = Me.CreateGraphics
    Dim intLoop As Integer = 0

    Private Sub btnStart\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        tmrMove.Enabled = True
    End Sub
    
    Private Sub tmrMove\_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrMove.Tick
    
    
        formSurface.Clear(Color.Black)
        Select Case intLoop
            Case 0
                formSurface.DrawImage(My.Resources.pacmanopen, 10, 75)
    
            Case 1
                formSurface.DrawImage(My.Resources.pacmanopen, 11, 75)
    
            Case 2
                formSurface.DrawImage(My.Resources.pacmanopen, 12, 75)
    
            Case 3
                formSurface.DrawImage(My.Resources.pacmanopen, 13, 75)
    
            Case 4
                formSurface.DrawImage(My.Resources.pacmanopen, 14, 75)
    
            Case 5
                formSurface.DrawImage(My.Resources.pacmanopen, 15, 75)
    
        End Select
        intLoop += 1
    End Sub
    

    End Class

    Could I possibly do something like...

            Case 0 to 100
                formSurface.DrawImage(My.Resources.pacmanopen, intX, 75)
    

    and then add 1 to intX each time? I'm open to any ideas...

    Visual Basic graphics question

  • Maximum number in an array?
    A Adam Wike

    I also figured out that the way I generated the random numbers made the code mess up. I ended up having to use

    strNumbers(intLoop) = Int((100 - 1 + 1) * Rnd()) + 1

    to get the random numbers.

    Visual Basic data-structures question lounge

  • Maximum number in an array?
    A Adam Wike

    It worked...to do the minimum I should only have to change the sign I guess. Thanks a lot :)

    Visual Basic data-structures question lounge

  • Maximum number in an array?
    A Adam Wike

    I need to make a program that generates 15 random numbers as an array and then lists them in a listbox. I also need to be able to display the maximum and minimum in a label. Heres what I've got so far...

    Public Class Form1
    Dim strNumbers(14) As String

    Private Sub btnGenerate\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
        Dim intRandom As New Random()
        Dim intLoop As Integer
    
        lstOutcome.Items.Clear()
    
        For intLoop = 0 To strNumbers.Length - 1
            lstOutcome.Items.Add(intRandom.Next(1, 100))
        Next intLoop
    
    End Sub
    
    Private Sub btnMaximum\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMaximum.Click
        Dim intLoop As Integer
        Dim intMax As Integer
    
    
        For intLoop = 0 To strNumbers.Length - 1
            intMax = strNumbers(intLoop)
            If intMax < strNumbers(intLoop) Then
                intMax = strNumbers(intLoop)
            End If
        Next intLoop
    
        lblMinMax.Text = intMax
    End Sub
    

    End Class

    I've got the 15 random numbers in the listbox. I just cant figure out why my maximum code isnt working. Any tips would be awesome right now...

    Visual Basic data-structures question lounge

  • Convert from decimal to hexidecimal?
    A Adam Wike

    Thanks for the help guys :)

    Visual Basic question

  • Convert from decimal to hexidecimal?
    A Adam Wike

    Is there a simple way to convert a decimal to an hexidecimal?

    Visual Basic question

  • Some help...
    A Adam Wike

    How would I get a program to show the numbers it adds up? Say the user wants the program to add numbers 1 through 10. How would I get the result to show up as "1+2+3+4+5+6+7+8+9+10=55"? I dont have a problem getting the program to add the numbers or anything. I just need help displaying the result, if it's any help I'll be using a loop. If I havent explained myself well enough let me know. Thanks :)

    rawr!

    Visual Basic help question

  • How to make text go away after a few seconds?
    A Adam Wike

    Alright thank you :) Im new to this so I didnt even know about that.

    Visual Basic tutorial question

  • How to make text go away after a few seconds?
    A Adam Wike

    When I click a button in my program some text pops up in a label. Is there a way to automatically clear/erase the text 5 seconds after clicking the button?

    Visual Basic tutorial question

  • Static Variables for Grade Counting Program [modified] - SOLVED
    A Adam Wike

    Your right, that is a lot less confusing and makes the program look less cluttered. Thanks!

    Visual Basic design help

  • Static Variables for Grade Counting Program [modified] - SOLVED
    A Adam Wike

    I figured it out :) Thank you both for steering me in the right direction. Not sure if its the most effcient way of making the program but it does what it's supposed to. Here is the final code...

    'Adam Wike
    'Computer Programming 1
    'Grade Counter
    'Created on March 28, 2010
    'Last Modified on March 30, 2010

    Public Class Form1

    'Declared all variables
    Private intA As Integer
    Private intB As Integer
    Private intC As Integer
    Private intD As Integer
    Private intF As Integer
    Private intE As Integer
    
    'Sets the variables to 0
    Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        intA = 0
        intB = 0
        intC = 0
        intD = 0
        intF = 0
    End Sub
    
    'Sets up the counter and calculates the percentage for each button
    Private Sub btnA\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnA.Click
        intA = intA + 1
        lblGradea.Text = intA
        intE = ((intA + intB + intC + intD) / (intA + intB + intC + intD + intF)) \* 100
        lblPassing.Text = Math.Round(intE, 2) & "%"
    End Sub
    
    Private Sub btnB\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnB.Click
        intB = intB + 1
        lblGradeb.Text = intB
        intE = ((intA + intB + intC + intD) / (intA + intB + intC + intD + intF)) \* 100
        lblPassing.Text = Math.Round(intE, 2) & "%"
    End Sub
    
    Private Sub btnC\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnC.Click
        intC = intC + 1
        lblGradec.Text = intC
        intE = ((intA + intB + intC + intD) / (intA + intB + intC + intD + intF)) \* 100
        lblPassing.Text = Math.Round(intE, 2) & "%"
    End Sub
    
    Private Sub btnD\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnD.Click
        intD = intD + 1
        lblGraded.Text = intD
        intE = ((intA + intB + intC + intD) / (intA + intB + intC + intD + intF)) \* 100
        lblPassing.Text = Math.Round(intE, 2) & "%"
    End Sub
    
    Private Sub btnF\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnF.Click
        intF = intF + 1
        lblGradef.Text = intF
        intE = ((intA + intB + intC + intD) / (intA + intB + intC + intD + intF)) \* 100
        lblPassing.Text = Math.Round(intE, 2) & "%"
    End Sub
    

    End Class

    Visual Basic design help

  • Static Variables for Grade Counting Program [modified] - SOLVED
    A Adam Wike

    My teacher want's me to design a program that does this. "Design a program that has five buttons, one for each grade. Each time you press a button it increments that grade by one. At the same time it updates a label that displays the current percent of students that passed the exam (grade higher than F)." This is what I have so far...

    Public Class Form1

    Private Sub btnA\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnA.Click
        Static intA As Integer = 0
        intA = intA + 1
        lblGradea.Text = intA
    End Sub
    
    Private Sub btnB\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnB.Click
        Static intB As Integer = 0
        intB = intB + 1
        lblGradeb.Text = intB
    End Sub
    
    Private Sub btnC\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnC.Click
        Static intC As Integer = 0
        intC = intC + 1
        lblGradec.Text = intC
    End Sub
    
    Private Sub btnD\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnD.Click
        Static intD As Integer = 0
        intD = intD + 1
        lblGraded.Text = intD
    End Sub
    
    Private Sub btnF\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnF.Click
        Static intF As Integer = 0
        intF = intF + 1
        lblGradef.Text = intF
    End Sub
    

    End Class

    I need help on that part that displays what percentage of students are passing. I assume you have to add together the toal number of grades and then divide by the total number above F and display that in a label. But I cant seem to figure that out...Thanks :-D

    modified on Tuesday, March 30, 2010 10:18 AM

    Visual Basic design help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups