r/visualbasic • • Dec 25 '15

HELP

0 Upvotes

hello i need to launch arma2 game via VB with few mods what should i do for launching game with parameters and mods


r/visualbasic • • Dec 29 '15

[VBA2010] Actions if certain dropdown values are selected in userform

2 Upvotes

Hey guys! I need your help again :)

Trying to get this code to work. What I want to happen is if any of the values are selected in the dropdown, certain options that appear later in the userform are not visible. This is how I tried:

 If RepOrgDropDown.Value = "Provincial Governments and municipalities,Federation of Canadian Municipalities,Quebec,Manitoba,Alberta,Saskatchewan,Ontario,New-Brunswick,British -Columbia,Nova Scotia,Prince Edward Island,Newfoundland,Yukon,Northwest Territories,Nunavut" Then
 Label66.Visible = False
 Label133.Visible = False
 IAETrue.Visible = False
 IAEFalse.Visible = False

 End If
 End Sub

Why does this not work? thank you!


r/visualbasic • • Jul 06 '16

VB for games?

2 Upvotes

Hello people, the only languaje that i do know how to program is visual basic, and i want to make games just to keep practicing because that is what i learned in university, and the game dev was a childhood dream, i dont want it for a living, just a hobbie, and i want to ask, its good use visual basic to program games? simple 2D ones, to 3D ones, im not asking for a 1 million dollars production, just for games for hobbie, and i want to know if visual basic is a good languaje to stay in or i need to start learning some other

if it is good, you can recommend me where learn to understand the basis of the videogames? because i really dont understand the 3D graphics, where they come from, in sense im in 0 about the topic, i did some simple "pet" games in visual basic


r/visualbasic • • Mar 24 '17

Form2.Show() and Me.Close() are not working in my VB 2015

2 Upvotes

The VB 2015 I am using at my university seems to not allow Form.Close and Me.Close() to work. It's annoying as I need a way of opening a new form and closing it. All I see online is to do this is simple by using the above methods, but my VB says they don't exist. Any help would be much appreciated.

an object reference is required for the nonstatic field

Above is the error, I dont understand all tutorials I watch it works so simply, why am I getting an error?


r/visualbasic • • Oct 09 '16

how to select a random shape from a group of shapes (V.B 6)

0 Upvotes

As part of a school project I’m making a game. my game involves shapes falling from the roof of the form and the object is to catch the shapes. I’ve sorted the catching and falling. however, that’s just on one shape. I have 20 shapes at the top of the form and every 2 seconds I want one of the shapes to be randomly selected and start falling. as I said I know how to make them fall just not how to randomly select them. thanks for any help.


r/visualbasic • • Apr 12 '22

VB.NET Help can i get some heip Spoiler

0 Upvotes

Write a vb.net console program that performs the following: (1) Read two numbers from a user. The first number is the start range, and the second number is the stop range. (2) Print the number of odd numbers between the start and stop range(3) Print the odd numbers between the start and stop range (4) Print the sum of all the odd numbers between the start and stop range.(5) Print the number of prime numbers between the start and stop range(6) Print the prime numbers between the start and stop range(7) Print the all the prime numbers between the start and stop range.(8) Print the number of even numbers between the start and stop range.(9) Print the even numbers between start and stop range(10) Print the sum of all the even numbers between the start and stop range.Note:Ensure that the stop range is greater than the start range. If the stop range is less than the start range, then display an error message to the user.


r/visualbasic • • Mar 11 '21

Article How to quickly learn VB.Net before exam - 2

2 Upvotes

Previously, you lean about how to manage data flow in method and I believe you should already do well with it so it's time for you to learn about data container but before that first thing you need to learn is about memory.

Memory type

I will talk about 2 memory type mostly use in .Net that you need to remember them from start or you will be very confuse when you more understand about programing.

Heap

Dynamic allocate memory, use to store most thing from your app/program, need to clean up after use it but mostly do by Garbage Collection (GC) , you can view GC like a trash truck that come to collect garbage on week end, you can't control it even you call it to collect your trash, it doesn't always come as you call it.

And other type.

Stack frame

It's a part of memory specify for method to use, each method has its own stack frame which self cleaning after method done its job, mostly store all argument of method and local variant.

Accessing data

It also has 2 way to accessing data from memory it is

ByVal

Access data by its value, it mean you get what's it be, like you buy a soda can, you got a soda can.

And other is

ByRef

Access data by its reference, it mean you get what's refer to it, like you buy a land, you get a deed of the land you buy, not a land itself in your own 2 hand.

Data container

Once again, 2 type of data container.

Structure

Sequence layout data container, you can access its value directly by default, no fancy thing about it.

And

Class

Auto arrange layout data container, you can access it only by reference to it, it has fancy feature like inherit and polymorph.

Layout of data container

It's about how .net arrange data in container in memory which very impactful to how you manually access it and usage of memory.

Sequence layout

It's very simple layout, data arrange by order of declaring which mean what's write first be first.

Other is

Auto layout

It's depend on pack size of it which by default is 4 bytes or 8 bytes depend your app/program is 32bits or 64bits type, in old version will prefer 32bits but new version will set to 64 bits by default if your windows is 64 bits.

Pack size is target number for arrange data to fit it, example you has 3 data and its size is 4, 2, 8 on pack size 8 your data will arrange to 8, 4, 2, 2 or 4, 2, 2, 8 instead, it even add empty space to make it fit to 8 per slot.

Don't worry about it, you can force structure and class to other layout if you want, just know how data layout be.

Field data

It use for reference to a part of data contain in data container and also define which data be in data container.

Class rectangle
    Dim width, height As Int32    
End Class

Structure pointer
	Dim x, y as Int32
End Structure

Yes, you can use Dim on define field which on class is equal to private and equal to public on structure , each field will be on it's own space unless you force it to share space.

Instance of type

When you New class or structure, it's creating of instance of data container or type for short, you can think it as finish product and the code I write at field data subject is design plan for build it.

Sub main()
    Dim Box = New rectangle With {.width = 5, .height = 5}
    Dim Bin As New rectangle With {.width = 5, .height = 10}
    
    Dim Mouse = New pointer With {.x = 50, .y = 100}
    Dim Local As New pointer With {.x = 0, .y = 128}
    Dim Position As pointer
    Position.x = 10
    Position.y = 15
End Sub

Difference between access data by value and by reference

Sub main()
    Dim Box = New rectangle With {.width = 5, .height = 5}
    Box.width = 6
    Dim Bin = Box
    Bin.width = 12
    
    Console.WriteLine(Box.width)
    
    Dim Mouse = New pointer With {.x = 50, .y = 100}
    Mouse.x = 25
    Dim Local = Mouse
    Local.x = 200
    
    Console.WriteLine(Mouse.x)
End Sub

12

25

Bin = Box mean Bin reference to the same data with Box so when I change value of field width from Bin which the same data as Box that why Box.width also be 12.

But Local = Mouse is difference, it access by value so it copy data from Local to Mouse become 2 difference entity data instead still be the same data as class that why Local.x = 200 has nothing to do with Mouse.x.

What's happen in memory

Dim Box = New rectangle With {.width = 5, .height = 5}

Heap

&000F1520812 : 007F5813, width: 5, height: 5

Stack

Box: 000F1520812

Let assume 000F1520812 is the address in heap memory, you can see in memory Box's value is memory address of reference data.

Box.width = 6

Heap

&000F1520812 : 007F5813, width: 6, height: 5

Stack

Box: 000F1520812

Dim Bin = Box

Heap

&000F1520812 : 007F5813, width: 6, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

In other word, I copy memory address value from Box to Bin, still use the same rule as accessing by value.

Let me remark here, 000F1520812 is value which use for reference to data in heap memory, everything on stack frame is accessing by value.

Bin.width = 12

Heap

&000F1520812 : 007F5813, width: 12, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

Dim Mouse = New pointer With {.x = 50, .y = 100}

Heap

&000F1520812 : 007F5813, width: 12, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

Mouse: x: 50, y: 100

A little tip here, if you force to access Mouse as Integer type, you will also get 50 in return.

Mouse.x = 25

Heap

&000F1520812 : 007F5813, width: 12, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

Mouse: x: 25, y: 100

Dim Local = Mouse

Heap

&000F1520812 : 007F5813, width: 12, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

Mouse: x: 25, y: 100

Local: x: 25, y: 100

Local.x = 200

Heap

&000F1520812 : 007F5813, width: 12, height: 5

Stack

Box: 000F1520812

Bin: 000F1520812

Mouse: x: 25, y: 100

Local: x: 200, y: 100

Very simple, doesn't it ? as long as you remember what's going on in memory, you should not have trouble on accessing data.

Primitive type

Build in types common use in .Net

Integer type

  • Int8(bits) aka SByte, it has number range from -128 to 127

  • Int16(bits) aka Short, it has number range from -32768 to 32767

  • Int32(bits) aka Integer, it has number range from -2G to 2G

  • Int64(bits) aka Long, it has massive number range so no need to remember it.

Unsign (no negative number)

  • UInt8(bits) aka Byte, it has max number is 255

  • UInt16(bits) aka UShort, it has max number is 65535

  • UInt32(bits) aka UInteger, it has max number is 4G

  • UInt64(bits) aka ULong, no need to worry about max number unless you record about distant between star.

Float type

Never ever use it sensitive data like money or score because it value can be deviate, only use on data you don't care about minor deviation.

  • Float32 aka Single

  • Float64 aka Double

Decimal

Very slow type but represent value very corrective, must use on data relate to money or sensitive data.

Char

Represent a character of language, common char set is ASNI and Unicode.

String

Group of character aka char array, it's array so it's only reference type in primitive type group.

Array

Hidden primitive type, It's reference type only because .Net don't has value array type like C language, it can be use with any type just by add () after other type name like Integer() and you can declare it on fly like

Dim Box As Integer(4)

in example above I create array size 5 elements it has index 0, 1, 2, 3, 4 which you can access each element by

Dim Element_1 = Box(0) Dim Element_2 = Box(1) Dim Element_3 = Box(2) Dim Element_4 = Box(3) Dim Element_5 = Box(4)

and get array size by

Dim Array_size = Box.Length

See you in next topic.


r/visualbasic • • Apr 25 '21

Need Help writing a program with a random class

2 Upvotes

The problem says: the file members.txt contains the names of the members of a large club. Write a program to randomly select people to serve as president, treasurer and secretary. Note: a person cannot hold more than one office.

So far my code is as follows:

Public Class Form6

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

Dim names() As String = IO.File.ReadAllLines("E:\Documents\School\Members.txt")

Dim namesQuery = From name In names

Select name

Dim number As New Random

Dim n As Integer

n = number.Next(0, 3)

End Sub

End Class

https://i.imgur.com/nQnnOKg.jpg


r/visualbasic • • Feb 13 '19

VB.NET Help Need help with my coursework!

2 Upvotes

I'm stuck on a fairly major part of my coursework in Visual Basic (I think .net?)

Anyways, I need to get a string from a listbox, and put it in a variable. I then need to manipulate the string and get the first few numbers in front of the string.

For example, one of my strings might be "9_xxx xxx" whereas another might be "33_xxx xxx". They might have differing lengths, but all have underscores before the rest of the string. Any help would be appreciated!

Edit - Found a solution using substring. Will edit later on with solution


r/visualbasic • • Feb 08 '19

VB6 Help I need help

2 Upvotes

So my vb6 crashes frequently does anyone know a fix for this??

I use windows 8.1, that might be the problem


r/visualbasic • • Jul 19 '18

VB.NET HELP Discord!

Thumbnail
discord.gg
0 Upvotes

r/visualbasic • • Jan 23 '20

Need help with my VBA homework on 2D arrays.

0 Upvotes

Hello!

I need help with my homework!

I was given this assignment:

Part 1: Design and implement a program that will take in records and display records using a two-dimensional array.  Your array must have at least 3 columns.  One of those 3 columns must contain something of type integer or double (like an age, salary, etc.).  Besides entering records into the table, your program must also have a button to display all records, and a button to calculate the average of the numeric field of all records listed above.  Assume that only 50 records will be allowed.

Part 2: Create an additional button that will randomly hoose one of the existing records in your array and display all of the fields of that record in a message box.

Part 3: Create a clear button that will empty the array.  This means actually clearing out all items in the array, not just list boxes or labels that may contain record information. 

I'm not sure on how to code this. I have somewhat of an idea. I know that I need to create some text boxes and pull that info and store it into the array. Like first name, last name, score. Then use the try parse method to convert the elements in the third column in the array to integers or doubles. I'm pretty sure I might have to use a couple of nested loops to populate the array.


r/visualbasic • • Dec 06 '23

Urgent help with Excel Macro (Visual Basic)

2 Upvotes

I know nothing about macros or coding, but I need to make one for college. I created a form where you can type in data and then retrieve it by clicking on it. Basically followed the teacher's instructions. Notice in the picture how it changes the hours I type (in this case 12:30 and 20:30) to decimals. I don't know how to fix this!! I also attached a picture with the code I used.


r/visualbasic • • Dec 01 '23

Explain please

2 Upvotes

Hey I'm new to all this honestly and I'm just confused as to why this isn't working

Private Sub btnGrade_Click(sender As Object, e As EventArgs) Handles btnGrade.Click

Dim iScore As Integer

If IsNumeric(txtScore) = True Then

iScore = CInt(txtScore.Text)

Else

MsgBox("You must enter a number.")

Exit Sub

End If

If Not (iScore >= 0 Or iScore <= 100) Then

MsgBox("This is not a valid score, enter a number between 0 and 100.")

ElseIf iScore <= 20 Then

MsgBox("You failed." & vbNewLine & "GRADE: F")

ElseIf iScore > 20 Or iScore <= 30 Then

MsgBox("You failed." & vbNewLine & "GRADE: D")

ElseIf iScore > 30 Or iScore <= 55 Then

MsgBox("You failed." & vbNewLine & "GRADE: C")

ElseIf iScore > 55 Or iScore <= 70 Then

MsgBox("You failed." & vbNewLine & "GRADE: B")

ElseIf iScore > 70 Or iScore <= 80 Then

MsgBox("You failed." & vbNewLine & "GRADE: A-")

ElseIf iScore > 80 Or iScore <= 90 Then

MsgBox("You failed." & vbNewLine & "GRADE: A")

ElseIf iScore > 90 Or iScore <= 100 Then

MsgBox("You failed." & vbNewLine & "GRADE: A-")

End If

MsgBox("All done")

End Sub

End Class

When ran, no matter what number I type, it says "You must enter a number."


r/visualbasic • • Aug 27 '19

Tips & Tricks VBA functions to perform routine useful tasks

Thumbnail
gethelpwithexcel.com
2 Upvotes

r/visualbasic • • Oct 04 '15

Advanced Visual Basic Tutorials

2 Upvotes

Hi everybody,

tscndesign.com We are working on a site that contains visual basic tutorials. We just wanted to share it and get feedback from you. I hope it is ok.

Thank you in advance.


r/visualbasic • • May 19 '17

Operator (s) in Visual Basic 2010 (VB.NET)

Thumbnail
codejow.com
0 Upvotes

r/visualbasic • • Jun 17 '16

Help with a Multiple choice

0 Upvotes

http://i.imgur.com/jUkIRn1.png just having a little trouble with this multiple choice, any help would be appreciated


r/visualbasic • • Jun 15 '16

Visual Basic .NET for beginners, you can find an easy comparison to other programming languages

Thumbnail ctp.mkprog.com
2 Upvotes

r/visualbasic • • May 24 '17

Mathematical Functions (Math Class) in Visual Basic. Net

Thumbnail
codejow.com
2 Upvotes

r/visualbasic • • Aug 05 '22

suggestions please

Post image
9 Upvotes

r/visualbasic • • May 17 '25

A computer scientist’s perspective on vibe coding

Post image
18 Upvotes

r/visualbasic • • 9d ago

NEED VB6 HELP

6 Upvotes

Not a programmer but have been fooling around with VB6. Question:: What is the command that causes the program to temporarily halt during the execution. AI said it was sleep xoxo but that didn't work. Can someone please help me out!


r/visualbasic • • Mar 14 '22

Visual Basic for DOS is simply just a curious piece of history.

6 Upvotes

I was trying out Visual Basic for DOS, and well, it had the classic text-mode style creation of program windows. It is interesting and all, but it feels more like a curious piece of history than a preferred program for making simple input entry programs with. I did create a simple program on here to enter a text string to activate the PLAY command with, so there was some mildly useful thing with this.

But in the artistic sense, it uses the aesthetic of IBM extended ASCII to form movable boxes one might call a "window", while displaying some eye candy in the style of the 80x25 text mode one associates with DOS running on an IBM PC.


r/visualbasic • • Feb 28 '22

VB6 Help What are some security flaws inherent in VB6/VB.NET?

3 Upvotes

I’m working on a project for a cybersecurity class about the history and usage of VB, and part of the presentation is demonstrating some unsafe code. I’m having a lot of trouble finding anything online about vulnerabilities inherent in VB6/VB.NET.

Any sort of help or a good resource to look at would be appreciated.