rusoaica's Profile User Rating: -----

Reputation: 34 Craftsman
Group:
Active Members
Active Posts:
203 (0.23 per day)
Joined:
10-March 12
Profile Views:
2,344
Last Active:
User is offline Aug 15 2014 11:30 AM
Currently:
Offline

Previous Fields

Country:
RO
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   rusoaica I'd love to change the World, but they won't give me the Source Code

Posts I've Made

  1. In Topic: Error Handling in Database Application using MS Access

    Posted 13 Aug 2014

    hello, tarpitsahu!

    You may wan't to use a try-catch block. This is always allowing you to handle errors and even debug more easily. And its working not only for a database management, but for ANY piece of code. Here is an example:

    Try
        Process.Start("http://www.microsoft.com")
    Catch ex As Exception
        MsgBox("Can't load Web page" & vbCrLf & ex.Message)
    End Try
    
    


    The Try block will try to run the code inside it. If any errors or exceptions occur, than the Catch block will trigger. MOre extensive information can be found even here, on dream in code: reference
  2. In Topic: Progress Bar HELP

    Posted 13 Aug 2014

    hello vivibuy88!

    For using a progress bar to show the percentage of a completed job, you need to know the maximum value and split that maximum value into how many steps you need (for instance, if the maximum value is 1200 and you want 100 steps, one for each of 100% percents, you divide the maximum value 1200 to how many steps you want, for instance, 100. This would equal 12. This is the value you need to increment each time a step is completed, so, at 1% you have progress bar value 12; at 2% you have 24, and so on.

    But from your code, you do this:

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    ProgressBar1.Maximum = counter
    
       For row_csv = 3 To LastRow
                counter = counter + 1
       Next
    End Sub
    
    


    which means that each time the loop cycles, you increment the Maximum value of the progress bar, NOT its value. This will result in different values for each of the percents. You need to know the maximum value of the progress bar, divide it by how many percents you want, increment the resulting value in the For loop and assign it to the Value property of the progress bar.

    Good luck!
  3. In Topic: Different text in a message box?

    Posted 12 Aug 2014

    hello, shywolf91!

    what i can think of right now is creating a string array which will contain all the text strings you want, and using a random number to display a random string from the array. Here is an example, to get yourself started:

    
    
    Dim ShowTxt() As String = {"geyd7-hdh7g-pght2-mjj8e", "h4ujk-lkdn1-njmn2-kdfk5", "sjkl2-kwwn4-malw7-emwa1"}
    Dim RandomNumber As New Random()
    
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            ProgressBar1.Value += 1
            If ProgressBar1.Value = 100 Then
                Timer1.Stop()
                FlatButton1.Enabled = True
                MsgBox(ShowTxt(random.Next(0, ShowTxt.Length)))
            End If
        End Sub
    
    


    Now, lets do the aftermath: random.Next(min, max) function will return an integer value between the minimum value and the maximum value - 1. For instance, random.Next(0, 3) will return a random integer with possible values of 0, 1 and 2. Because of that, we set the random value to start from 0 and reach the maximum value of all the elements of the string array (which, remember, is 0 index based!).
    Also, keep in mind that the random function MAY return same value multiple times, so if you are trying to do something like a key generator, you may want to check first if the string wasn't already displayed, in order to display only unique strings.

    Good luck!
  4. In Topic: Why is my form is different sizes in build than in debug?

    Posted 8 Aug 2014

    I remember, it once drew me crazy, too. No code related to size, yet it was different. The reason? Change AutoScaleMode of your form from "Font" to "None". Hope that helps ;)
  5. In Topic: Declaring variables: when and why

    Posted 5 Aug 2014

    Another thing, about you example

    Dim myVariable As String = "text"
    MyFunction(myVariable)
    
    


    if you only use the variable myVariable as a calling argument of a function, it might not be necessary to declare a variable for it. But if you use that value a lot, like calling the function multiple times or in different places, you might want to use a variable. For instance, let's say you have the function

    GreetWorld("hello")
    
    


    called 100 times. If you ever have to change the string of your argument, it would be time consuming to replace all the instances of that string. But if you would use

    Dim Greeting As String = "hello"
    GreetWorld(Greeting)
    
    


    you would only have to change the value of the Greeting variable, and all the functions would have the argument changed. This is a sample example, but in more complicated and advanced situations, it would become a real pain to hard-code lots of values that might change over time.

My Information

Member Title:
D.I.C Head
Age:
29 years old
Birthday:
August 22, 1984
Gender:
Location:
Bucharest, Romania
Interests:
Music, Astronomy, Programming, Artificial Intelligence, Electronics, SF and gothic.
Full Name:
Yulia Danilova
Years Programming:
5
Programming Languages:
C, C++, Javascript, Visual Basic Net, C#

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.rusoaica.com
Yahoo:
Yahoo  rusoaica3@yahoo.com
Facebook:
https://www.facebook.com/yulia.danilova.587

Comments

rusoaica has no profile comments yet. Why not say hello?