r/visualbasic • • Nov 02 '18

Using If Else to Calcuate Wages .

5 Upvotes

Hey guys so am making a wage Calc and i am using If Else to perform the calculations if Hours are above 0 make the calc or show a error message if they are 0. Although it doesnt the show error message when hours are 0

Public Class frmGross
Private Sub btnCalcuate_Click(sender As Object, e As EventArgs) Handles btnCalcuate.Click
    Dim decHours As Decimal
    Dim decHourlyWage As Decimal
    Dim decTotalPay As Decimal

    decHours = txtHours.Text
    decHourlyWage = txtHourlyWage.Text
    decTotalPay = decHours * decHourlyWage

    LblTotalPay.Text = decTotalPay

    If decHours >= 0 Then
        decHours = txtHours.Text
        decHourlyWage = txtHourlyWage.Text
        decTotalPay = decHours * decHourlyWage
        LblTotalPay.Text = decTotalPay.ToString("C2")
    Else
        LblTotalPay.Text = "Error"
    End If
End Sub

Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click
    Me.Close()
End Sub

End Class


r/visualbasic • • Oct 25 '18

How to make a "Switch" Button

5 Upvotes

This is my code. Disregard the last sub, it does not work.

'**********************************************************************

'Programmeur: Lucas Després *

'Date: Octobre 2018 *

'But: De convertir les unité de mesure de la température *

'a Celcius et Fahrenheit et vice versa *

'**********************************************************************

Public Class frmConversion

Private Sub frmConversion_Load(sender As Object, e As EventArgs) Handles MyBase.Load

AcceptButton = btnConvertir

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnConvertir.Click

'Crée un Integer pour Fahrenhei et Celcius

Dim intF As Double

Dim intC As Double

intC = Val(txtbxEntree1.Text)

intF = Val(txtbxEntree2.Text)

intF = (intC * 9.0 / 5.0) + 32

intC = (intF * 5.0 / 9.0) - 32

Me.txtbxEntree2.Text = intF

End Sub

Private Sub btnSwitch_Click(sender As Object, e As EventArgs) Handles btnSwitch.Click

Me.lblCelsius.Text = "Fahreneheit"

Me.lblFahrenheit.Text = "Celsius"

Me.lblC.Text = "°F"

Me.lblF.Text = "°C"

End Sub

End Class


r/visualbasic • • Oct 23 '18

I'm making a program to convert Celsius to Fahrenheit for school and I do not understand what is not working

5 Upvotes

'This is my code

'I think there is something wrong with the math because when I try and convert it, the numbers are not right.

'Also, I would like to make it that If the temperature is above 0° then the background image changes to a sun. And if it's under 0° then the background image changes to like snow or something.

'**********************************************************************

'Programmeur: Lucas Després *

'Date: Octobre 2018 *

'But: De convertir les unité de mesure de la température *

'a Celcius et Fahrenheit et vice versa *

'**********************************************************************

Public Class frmConversion

Private Sub frmConversion_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Crée un Integer pour Fahrenhei et Celcius

Dim intF As Integer

Dim intC As Integer

intC = Val(txtbxEntree1.Text)

intF = Val(txtbxEntree2.Text)

intF = (9 / 5) * (intC + 32)

intC = (5 / 9) * (intF - 32)

Me.txtbxEntree2.Text = intF

End Sub

End Class

'Please help me fix this


r/visualbasic • • Sep 26 '18

VB 5.0 modern equivalent?

5 Upvotes

I help manage a number of machines in a manufacturing plant that use VB 5.0 for the user interface and some basic PLC communications. As I'm sure you can imagine, our computers are old. So, I'm trying to sort out what we need to get the system updated. Are there any drop-in programs that will work with a modern computer and read the code as originally written? Or is VB 5.0 so out-dated that the whole thing will either need to be heavily modified or completely rewritten?

I was thinking I'd bring in some Raspberry Pi's and throw on whatever software is needed to run the code and leave it at that. That said, I'm not that knowledgeable of computers and am open to suggestions. Thanks in advance!


r/visualbasic • • Sep 04 '18

What's a good method of sharing VB projects with friends/family without Chrome, etc. blocking it as a potential virus?

5 Upvotes

I'm working on a game recently, and every time I try to send a copy of the exe to a friend or family member, they get nothing but hassles from their browser and/or OS that it's probably a virus. The file is either blocked from downloading altogether, or prevented from running.

While I completely understand the need for these safety measures, I'm wondering what the best work-arounds are for legitimate developers to share temporary builds of their projects for testing purposes. Filedropper.com seems to work best at this point. You don't even need to sign up or login to use it. But some browsers/machines still complain when friends try to test my latest builds. I'm sure there are other options I haven't thought of.


r/visualbasic • • Jun 25 '18

What is the difficultly level in making a top down zombie survival game with XNA and vb.net?

5 Upvotes

I'm about to start my main computer science project for my A-levels, and I have chosen to do a top down zombie game (basically the game "Over 9000 zombies" and it was made with XNA) which is like Call of Duty zombies but in a top down format.

I'm an alright programmer (6/10) for my age, but I don't know if I am biting off more than I can chew. If anyone is familiar with XNA with VB could you tell me if it's too ambitious and give me some tips with using XNA.

Thanks.


r/visualbasic • • Jun 07 '18

Remembered an old trick, thought I'd share

Post image
5 Upvotes

r/visualbasic • • Mar 21 '18

VB6 Help Writing an inventory program in Visual Basic on Visual Studio 2017 with MS access 2016

5 Upvotes

I'm pretty much all but done. I have two forms, one for payment/selling and one is inventory. How do I make it so that when I sell something in payment/selling form it gets deducted from its value in inventory? I.e if I have 5 pills in the inventory table and I sold 3 then the pills should be 2 etc.


r/visualbasic • • Mar 05 '18

VB6 Help Project Help

5 Upvotes

Hi Im Learning VB 2015 in College and i have to create a project that you can order pizza through and each size has a price per topping except cheese but i was wondering how to have specific prices for toppings for each size if that doesn't explain it these are the protect requirements: Cost of toppings is dependent on the size of the pizza. All toppings are the same price for that size. Small pizza $6.00, topping $1.00 Medium pizza $10.00, topping $1.50o Large pizza $15.00, topping $2.00


r/visualbasic • • Dec 10 '17

Hey r/VisualBasic! I did my high school senior exit project in VB! It's a little digital assistant. Feel free to check it out!

Thumbnail drive.google.com
5 Upvotes

r/visualbasic • • Sep 29 '17

How to learn visual basic?

5 Upvotes

I can't find any good tutorial. Most of them are too old, the only decent one I've found uses VB 2010.


r/visualbasic • • Jul 20 '17

VB.NET Help Moving the Form while a Process is still running?

5 Upvotes

Hi there. So I am trying to make a Youtube-DL GUI, and am a bit stumped.

Here is the code I used.

Here, meanwhile, is the form design.

Here are my checklists, and if you guy could help me out, I owe you a big virtual hug/high-5!

  • I cannot move the form while the youtube-dl process is still running.

  • In CMD/batch, the youtube-dl's percentage is updated on a single line, while I cannot do so & have to make a new line for each percentage.

  • In connection with list 1, I cannot click anything while the process is still running.

  • BONUS: displaying percentage of each video's progress in progress bar. If list 2 is achieved, this one should be alright.

Thanks in advance!


r/visualbasic • • Jun 17 '17

Memory Game ( Concentration )

5 Upvotes

Hello, I'm in need of help with trying to make a Memory game, 4x4 with score and guesses. If anyone knows a guide on how to make one or can help me please let me know. thanks! :)


r/visualbasic • • May 10 '17

alright so i know what the problem is i just dont know how to fix it. But intcounter is 0 so its outside the bounds of the array. this happens everytime i try to vote(doubleclick) on a second name in the listbox.

Post image
5 Upvotes

r/visualbasic • • Apr 06 '17

[VB2010] How do I make what I type into input box display in list box? (Another question in text below)

5 Upvotes

The other question I have is that I have to make the program allow people to type in facts about a subject, and I was wondering if there is a way either the Input Box or a label above the List Box count down how many facts there are left that the user has to post (out of 5) using For Next Loops.


r/visualbasic • • Feb 03 '17

Thank you guys for reporting the spam.

5 Upvotes

I don't know how else to fight it other than limiting submissions to older accounts. I feel like that might prevent some legitimate posts from coming through.

Anybody else have any ideas?


r/visualbasic • • Dec 11 '16

How can i play two sounds at once?

5 Upvotes

I am making a drum machine for my college project and need to be able to have different sounds played at the same time for example a snare and a kick drum sound. similar to this https://www.youtube.com/watch?v=2y4549AjgEE however the only way i can get a series of beats to play is to use audioplaymode.waittocomplete, however due to the different length of sounds that i am using this is messing up the timing

this is the main code for the program

    For x = 0 To 15
        before = Date.Now.TimeOfDay.TotalMilliseconds()
        If beat(x, 0) = True Then
            My.Computer.Audio.Play(My.Resources._183105__dwsd__hat_appetizer, AudioPlayMode.Background)
        End If
        If beat(x, 1) = True Then
            My.Computer.Audio.Play(My.Resources._73038__stenen1__a_snare, AudioPlayMode.Background)
        End If
        If beat(x, 2) = True Then
            My.Computer.Audio.Play(My.Resources._264601__veiler__kick_swedish, AudioPlayMode.Background)
        End If
        While time < 700
            after = Date.Now.TimeOfDay.TotalMilliseconds()
            time = after - before
        End While

    Next

also here is a picture of the program currently https://gyazo.com/b529aee203b2827d5a088cfb7b0a77dd ignore the bpm box i haven't currently implemented it yet


r/visualbasic • • Nov 08 '16

Article Magic Forms Access in Visual Basic and C# -- Visual Studio Magazine

Thumbnail
visualstudiomagazine.com
5 Upvotes

r/visualbasic • • Oct 20 '16

Reasoning behind backwards loop

5 Upvotes

I am running some code to look through our bank and match it to our accounting, and i am using a for i=m to 1...next loop - step -1. When i change it to go forward ( step+1) it messes everything up. I've seen this before, but why?


r/visualbasic • • Sep 29 '16

Adding a shortcut to my application via Windows Explorer context menu?

5 Upvotes

So, I'm thinking this will involve editing the registry, but how can I achieve something like this? I want to make a shortcut to my application via the context menu when the user right-clicks a folder or any empty space in the Explorer window.

Basically the effect I want to mimic is like this. Is this possible to do using VB?


r/visualbasic • • Jul 31 '16

VB.NET Help How can I write this output to a textfile everytime when the application is exiting so the end user can read it to diagnose problems?

Thumbnail
imgur.com
5 Upvotes

r/visualbasic • • May 17 '16

How to upload VB project to Azure

5 Upvotes

I want to be able to run my project on the college computer and they do not allow applications to be installed.

The program is a windows form application so I assume I can't just publish it to Azure.

Is there any way to get this to work without installing in on the computer?

If not I guess I will have to borrow someone's laptop.

Thanks


r/visualbasic • • May 05 '16

[VBS] Adding only numeric variables

5 Upvotes

I have something like this:

var1 = 34.5
var2 = 61.5
var3 = 5.9
.... 'etc
 newVar = var1 + var2 + var3 + ....

But var1 through varX could have a non-numeric value, and I want to sum them if they are valid numbers. My first thought is:

If isNumeric(var1) And isNumeric(var2) Then
    newVar = var1 + var2
End If

If isNumeric(var3) and isNumeric(var4) Then
    newVar = newVar + var4 + var4
End If

But this presents two problems:

  1. It's ugly and wildly inefficient

  2. If var1 is numeric and var2 is NOT, then var1 gets left out of the sum

Is there a way to do this in a compact loop? Can someone point me in the right direction?


EDIT! I solved it with this:

arrVals(0) = var1
arrVals(1) = var2
arrVals(2) = var3
.... 'etc

For i = 0 to UBound(arrVals)
    If IsNumeric(arrVals(i)) Then
        newVar = newVar + arrVals(i)
    End If
Next

r/visualbasic • • Mar 14 '16

Add Try/Catch en masse to program with no error traps?

5 Upvotes

So full disclosure, I am not a programmer but thanks to Google and persistence I have actually put together a functioning program to import CSV's to an Access Database (It's NOT pretty under the hood) that I am happy with.

The problem I have is that this program is fairly large at close to 2000 lines and I didn't even understand error trapping when I started.

My question is, is there a way to add a Try/Catch to every subroutine at once, or do I just need to bite the bullet and get to dropping them in manually? Sorry if this is a silly question.

Thanks for taking the time to read my question.


r/visualbasic • • Feb 16 '16

[VBA] I need some suggestions on what visual studio has to offer.

5 Upvotes

I have a computer science background, and I've already picked up on the VBA language. My future employer wants me to come up with a training plan so they know I understand everything completely in Visual Studio and VBA before I actually start on the main project. Any suggestions on what I could do? Is there some type of "hierarchy" of VBA tools in Visual Studio?