Coolsyllable names(?) play

Posts 1–15 of 17 · Page 1 of 2
syllable names(?) play
hi
Allows you to play a hexadecimal
I'm studying VB.NET
Thank you
Console.Beep <<

Code:
Public Class Form1
    Public int1(20) As Long
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim text As Integer
        For i = 0 To TextBox1.Text.Length - 1
            text = dec(TextBox1.Text.Substring(i, 1))
            Try
                beep(int1(text))
            Catch ex As ArgumentException
                Wait(200)
            End Try
        Next
    End Sub
    Private Sub beep(ByVal v1 As Integer)
        Console.Beep(v1, 400)
    End Sub
    Sub Wait(ByVal cTime As Long)
        Dim sTime As Long
        sTime = GetTickCount + cTime
        Do While sTime >= GetTickCount
            Application.DoEvents()
        Loop
    End Sub
    Private Function dec(hexa As String) As Long
        dec = Val("&H" & hexa)
    End Function
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        int1(1) = (262)
        int1(2) = (294)
        int1(3) = (330)
        int1(4) = (349)
        int1(5) = (392)
        int1(6) = (440)
        int1(7) = (494)
        int1(8) = (523)
        int1(9) = (555)
        int1(10) = (591)
        int1(11) = (610)
        int1(12) = (653)
        int1(13) = (701)
        int1(14) = (755)
        int1(15) = (784)


    End Sub
End Class
I like it. Keep up the good work.
Ayyyye that cool.


Also, on this part
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        int1(1) = (262)
        int1(2) = (294)
        int1(3) = (330)
        int1(4) = (349)
        int1(5) = (392)
        int1(6) = (440)
        int1(7) = (494)
        int1(8) = (523)
        int1(9) = (555)
        int1(10) = (591) 
       int1(11) = (610) 
       int1(12) = (653)
        int1(13) = (701)
        int1(14) = (755)
        int1(15) = (784)
    End Sub
Since its already in an array, couldn't you do something like this?
Code:
int1{0, 262, 294, 330, 349, 392, 440, 494, 523, 555, 591, 610, 653, 701, 755, 784}
Correct me if I'm wrong.
Quote Originally Posted by DawgiiStylz View Post
Ayyyye that cool.


Also, on this part
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        int1(1) = (262)
        int1(2) = (294)
        int1(3) = (330)
        int1(4) = (349)
        int1(5) = (392)
        int1(6) = (440)
        int1(7) = (494)
        int1(8) = (523)
        int1(9) = (555)
        int1(10) = (591) 
       int1(11) = (610) 
       int1(12) = (653)
        int1(13) = (701)
        int1(14) = (755)
        int1(15) = (784)
    End Sub
Since its already in an array, couldn't you do something like this?
Code:
int1{0, 262, 294, 330, 349, 392, 440, 494, 523, 555, 591, 610, 653, 701, 755, 784}
Correct me if I'm wrong.
I haven't ran, but you could.
Quote Originally Posted by LilGho$t View Post
I haven't ran, but you could.
Making sure I was right
You could (should?) also change
Public int1(20) As Long '//because not all 21 (0-20) items are used by the program.

Get rid of the "20" and it will make the list the correct size for the data. (assuming you changed the line for array decl/initialize)

But for this type of thing, it's not really a problem.
Quote Originally Posted by abuckau907 View Post
You could (should?) also change
Public int1(20) As Long '//because not all 21 (0-20) items are used by the program.

Get rid of the "20" and it will make the list the correct size for the data. (assuming you changed the line for array decl/initialize)

But for this type of thing, it's not really a problem.
Little question. What the difference in setting a number of objects in an array than to just to declare an array?

Like..
Code:
anArray()

vs

anArray(20)
What differences are there?
How many bytes are used in ram.

anArray(20) has 21 objects. So 21 * size_of_object_in_bytes.

anArray() has 0 objects, and is merely a "reference to an array.", no bytes taken yet. (not technically true)

References are kind of a complex subject, if you care, add me on skype.

-Probably more differences (obviously. Not sure off top of my head).
Quote Originally Posted by abuckau907 View Post
How many bytes are used in ram.

anArray(20) has 21 objects. So 21 * size_of_object_in_bytes.

anArray() has 0 objects, and is merely a "reference to an array.", no bytes taken yet. (not technically true)

References are kind of a complex subject, if you care, add me on skype.

-Probably more differences (obviously. Not sure off top of my head).
I'd personally ditch the array and use a "List(Of Integer)"

A lot nicer to resize and use.
Code:
Dim x As New List(Of Integer)
x.Add(1)
That, in my opinion, is a much nicer alternative to "Dim IntArray(20) As Integer"
This shit looks copy and paste. Good Job
@TF2 Your post count is almost > 5, GJ. [/sarcasm]
Trash. (not bc of postcount, bc of attitude)

@OP: I wonder if you'll modify this program in the future....maybe try to make a demo (cool song?) or something out of it (I'm lacking imagination)? Anyway, keep it up. -Even if an app isn't "useful", if you learn something from it, it had value.
Thank you for reading.
Array is a good idea.
Immature ashamed.
I don't speak english well. so comment understand is hard
Quote Originally Posted by pootuba View Post
Thank you for taking the time to read.
Array is a good idea.
Immature ashamed.
I don't speak english well. so comment understand is hard
For someone that doesn't speak English well, I didn't have to hire the Pentagon to decrypt what you just said. (Most people don't even fully type the words out.)

Use an array though! It saves coding time, and makes everything look just *that* much neater.
mm...code is small, but good. Learning is good.

Don't be ashamed (If you try to say this). Be proud. In future, maybe you are great programmer. Now, focus on learn.

Keep learning / sharing

@riley lol. I HATE when people who "don't speak english" use slang words that they shouldn't even know! "ur, gonna" etc etc.
I guess if you learned english on the inet, then maybe that's why, but...what the..
Makes me think they're trolls half the time.


@OP Your English is ok You did use an array. (Complex -->) You just didn't initialize it in a neat way. I can't think of the words..um... Array declaration / initialization I think? I think you will learn soon enough.
Posts 1–15 of 17 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?