r/visualbasic • • Dec 22 '22

VB.NET Help Game with mostly controls on Windows Forms

6 Upvotes

So I'm making a game that's heavy with controls. For example on one screen I have around 40. Is there a problem with heavy use of controls? I think my game finds it hard to read the properties of them as there isn't really anything coded from my end to access them. My code seems fine and my A Level CS teacher thinks it all looks good as well... Is there a way to get around this? She suggested typing out all of the properties for the controls but that doesn't seem efficient. Thanks. If my code is needed let me know and I'll screenshot it into here.


r/visualbasic • • Dec 19 '22

How to automate Test plan creation in VB.NET?

6 Upvotes

Hi,

I need your advice. I work at an automation company as a technician. We develope and sell our own automation software. My job at the company is to configure and test customer PCs.

My biggest issue is that we still create our test plans manually. I want to automate this process for my department, I just don't know where to start. We use MS Word Templates to create our test plan. Our software allows modular configuration, that is why our MS Word templates contain all possible test points for all possible configurations. So we take these templates and MANUALLY delete unnecesary test points until we have a customized test plan for each customer. We use MS-Word because of text editing and the ability to export to PDFs.

I know this entire process, and then some, can be automated, I just don't know where to start. Is there a MS-OFFICE API I should look into? I have some VB.NET programming knowledge, so I could throw together an interface to add or remove software modules the customers ordered, I could also create the back-end to sort out the test points based on selected modules.

I'm only asking for ideas on where to start. Thank you all in advance!


r/visualbasic • • Nov 23 '22

I've hidden a message and an audio file in a program I had to make at school and almost every key triggers this event, what will the teacher say?

6 Upvotes

r/visualbasic • • Nov 03 '22

Can i install Visual Basic 2010 and Visual Basic 2022 at the same time ?

6 Upvotes

i need answers tyy


r/visualbasic • • Oct 16 '22

Has anyone got visual basic (visual studio) working with a MYSQL db?

6 Upvotes

Been trying to just drop a simple datagrid on a form all day, what a shitshow. Had to revert to VS2019 because VS2022 doesn't support MYSQL, and even after getting it to connect, nothing works ie "add data source" crashes, table design doesn't work etc etc.

Unfortunately I have to use MYSQL, has anyone got it working?


r/visualbasic • • Sep 15 '22

VB.NET Help Save Json Array of strings <byte> as pdf

6 Upvotes

I'm getting a FedEx SPoD (as a PDF) from Track Document, which, when passed the Mock Tracking Numbers, returns:

Array of strings <byte>
Specifies the image of the recipient's signature (if the signature 
is available) once the shipment has been delivered.
Example: [byte1,byte2]

The return can be seen on Google Drive.

How do i save that as a pdf?


r/visualbasic • • Sep 12 '22

Resources or Example code for VB3?

6 Upvotes

Does anyone know of an online resource or a repository of code written in VB3 for Windows 3.1?

I'm trying to write an app for Windows 3.1. I wrote a bit of VB6 a long time ago and VB.Net back in 2010 - 2012 but shifted to mostly C#/PowerShell since then.

I'm just looking for something that goes over the language basics as they apply to VB3. I should be able to figure things out from there.


r/visualbasic • • Aug 10 '22

Array oneAoneF passes to procedure but doesn’t get populated! Why?

Post image
6 Upvotes

r/visualbasic • • Jul 22 '22

Finding a stray Streamreader Txt document

6 Upvotes

so im a little rusty at all this, but i ended up saving a text file through streamreader and first i used code to put the "test.txt" file on my desktop, and then after making sure it wrote everything correctly I added a line to save the file in destination chosen by the "SaveFileDialog1", and I did this with FileDestination = savefiledialog1.showdialog, it asked if i wanted to overwrite and i said yes but it didn't work, and then i used breaks to see where the problem was and that the SFD1.showdialog was returning a "1" because I was clicking "save" or a true/affirmative result from the dialog. I fixed that up with SFD1.filename.

with my save button working i went over to my load button which was set to read out the first line in a message box to make sure that was working, but since it had the same .showdialog from before i knew it was messed up, but it was also reading the original test line instead of what it fixed overwritten txt file should be reading now, which means there's basically a slightly appended .txt document somewhere in the computer at wherever "1"/"a yes dialog response" is located. i tried to search for the file name and for the line, but so far no luck.. im sure it's no issue to have a microscopic notepad file lost in the abyss somewhere, but I'd rather go delete it. anyone know where the file might be located?


r/visualbasic • • Jul 11 '22

VB6 Help How do i make the array be the entire first column except the first row.

Post image
6 Upvotes

r/visualbasic • • Jun 25 '22

VB.net HomeWork Help

6 Upvotes

I'm trying to answer the following question

Write a program that accepts three Integer numbers from the user and returns FOUND if one of the integers is the midpoint between the other two integers; that is, if one integer is exactly halfway between them. Your program should print NOT-FOUND if no such midpoint relationship exists.

The code I wrote is below. I'm sure my problem lies in assigning an equation into the results. Any pointers?

Public Class Form1

Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click

Me.Close()

End Sub

Private Sub BtnMidpoint_Click(sender As Object, e As EventArgs) Handles BtnMidpoint.Click

Dim intNumber1 As Integer

Dim intNumber2 As Integer

Dim intNumber3 As Integer

Dim Result1 As Double

Dim Result2 As Double

Dim Result3 As Double

Result1 = (intNumber1 + intNumber2) / 2

Result2 = (intNumber2 + intNumber3) / 2

Result3 = (intNumber1 + intNumber3) / 2

If Not Integer.TryParse(txtFirstNumber.Text, intNumber1) Then

txtFirstNumber.Focus()

MessageBox.Show("Please enter a valid positive integer value as number 1")

ElseIf Not Integer.TryParse(txtSecondNumber.Text, intNumber2) Then

txtSecondNumber.Focus()

MessageBox.Show("Please enter a valid positive integer value as number 2")

ElseIf Not Integer.TryParse(txtThirdNumber.Text, intNumber3) Then

txtThirdNumber.Focus()

MessageBox.Show("Please enter a valid positive integer value as number 3")

Else

If Result1 = intNumber1 Or intNumber2 Or intNumber3 Then

MessageBox.Show("Found")

ElseIf Result2 = intNumber1 Or intNumber2 Or intNumber3 Then

MessageBox.Show("Found")

ElseIf Result3 = intNumber1 Or intNumber2 Or intNumber3 Then

MessageBox.Show("Found")

Else

MessageBox.Show("Not Found")

End If

End If

End Sub

End Class


r/visualbasic • • Jun 12 '22

VBScript How do I create a external reference to a workbook with multiple sheets with varying names.

6 Upvotes

I am a big time noob with VBA. What I am trying do is to use Xlookup to find matching values to my current sheet. But I am having difficulty creating a external reference to find those values in another workbook. I know the general external reference is [Filename]Sheet_1!"A""B".

But I need to to reference cells "A" and "B:F" in 40 different sheets all with different names in the externally referenced workbook. Is there any way I can achieve this with VBA?


r/visualbasic • • May 16 '22

VB.NET Help Return single value from a function that returns an array

6 Upvotes

I have a function that will return an array of values like:

function abc(input) as double()

The result is an output with {data a, data b}. Normally if I want to extract the information I have to do:

dim something as double() = abc(input)

whatiwant = something(0)

So instead of dim "something" can I extract the first item directly from the function abc?


r/visualbasic • • May 12 '22

vb.net

6 Upvotes

Is there a way that can make this Group box "Receipt" stay in there even when I scroll down?


r/visualbasic • • Apr 26 '22

About to lose my mind over this, I've got the computer equivalent of schrödinger's cat paradox.

6 Upvotes

For background I'm using a USB to com port adapter hooked into a metler Toledo scale and a gom-804 miliohm meter. The code I'm using to open the com port is

Open "com7:9600,N,8,1,X" for binary access read write as #1

This all works flawlessly under one condition. I must connect to the equipment individually through a com port terminal and view the results once. After that I can close the terminal and it will work flawlessly. However if I lock my PC, unplug and replug the devices, or just login for the first time that day it will not work on the fly. It will send data over the com port I know that much (it has send and receive lights) however whatever it's sending is wrong because the devices won't reply. I can trigger a reply though so if I force a reply the PC for some reason won't receive it.

So my current issue is, it sends all wrong, and it won't receive data.

I've been working on this for hours and I think I've gone braindead and would love some insight if anyone has anything.


r/visualbasic • • Apr 07 '22

Choose the correct instance of many

6 Upvotes

Hi,

Edit below (figured it out).

I have an Inventor add-in which fails to do what I want if I have several instances of Inventor open.

Instance #1 with part 1Instance #2 with part 2

If I do anything on Instance #2 which should alter the part 2, it chooses to do so on the first instance that was created. This results in changes that was supposed to be on part 2 to affect part 1 instead.

I assume this has something to do with how I set my Inventor application.

Dim invapp As Inventor.Application = GetObject(, "Inventor.Application")
or
Dim invapp As Inventor.Application = Marshal.GetActiveObject("Inventor.Application")

This code above seem to always choose Instance #1 of Inventor.

I've tried to mess around with process.getcurrentprocess shenanigans (which will differentiate between the several instances), but it doesn't seem possible to use any of that information to get the object.

Anyone have some tips how to do this? I've spent the last 2 hours googling this, but can't find anything useful.

Thanks for any help!

Edit:

Figured this out.

Dim Invapp As Inventor.application = g_inventorApplication

This wasn't something someone could've figured out unless you had my VS template (for Inventor), but ill keep it up incase someone from the future is looking for answers.

Mods can delete if they want.


r/visualbasic • • Apr 02 '22

What modern languages are most similar to visual basic?

6 Upvotes

This was the only language I knew as a kid and want to get back into it, but modern programming languages seem much more difficult for me to learn.


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 • • Mar 13 '22

How to display the current timezone on a label in vb.net

6 Upvotes

For my windows forms app, I need to display the user's current time zone on a text label. The piece of code I have right now is UI_SystemTime_Timezone.Text = TimeZone.CurrentTimeZone.ToString() but that literally makes the label say Timezone.CurrentSystemTimeZone. So how do I make it actually display the time zone?

EDIT: I fixed it by replacing the code with UI_SystemTime_Timezone.Text = TimeZoneInfo.Local.ToString()


r/visualbasic • • Mar 05 '22

VB.NET Help Create Message before windows locks workstation

6 Upvotes

I am wanting to create a small program that will display a message about 1 or 2 minuets before windows locks the user session. I have seen this before on the computers at my college campus and at my work. It displays a small message that states "No activity has been detected for a little bit now. This workstation will lock in blah minuets." or something like that. Is it possible to recreate this in Visual Basic and if so What code would I need in order to make this work? I don't use screensavers and I have it set after like 30 minuets to lock in Group Policy since I have a homelab with an Active Directory Domain Setup. I have tried using task scheduler to run a program when the system goes idle but I apparently don't understand how that works and how it detects the system is idle.


r/visualbasic • • Dec 30 '21

Can I use VB in Excel to simplify a warehouse management task?

6 Upvotes

I am trying to simplify a task currently being done manually using Excel, usually taking multiple hours right now. It’s been many years since I used VB and I’m primarily trying to figure out if what I want to do is possible using VB. The warehouse management software isn’t setup properly to consolidate our inventory and we regularly need to optimize our location utilization. The warehouse holds up to 7500 pallets across 2000 locations. We have an outflow of 100-150 pallets every ~12 hours and generally get 100-300 pallets delivered daily.

I want to be able to paste a large data set into an excel sheet and have it give me an output that can be printed on a second sheet within that workbook. I would need to declare all locations, how many pallets each can hold and all height or weight restrictions for specific locations or items. The program would need to count how many times a location is used. If a location isn’t full, pallets with the same Item# and Lot# should be listed in the output so they can be combined together. Ideally the output would simplify the data to just important identifying info for the pallets, as opposed to it transposing all info it’s been given in the original data set.


r/visualbasic • • Nov 10 '21

A silly mistake regarding alignment and RightToLeft

6 Upvotes

Just a silly mistake i made. I was setting a label to display some data and wanted it aligned left, but it kept showing right. So, i set the alignment to be right, and it was left. What in the world?!

Silly mistake. I had inadvertently set .RightToLeft while going through the options. Doh! And so, for your amusement:

Public Class Form1
	Private Sub Form1_Load(Sender As Object, Arguments As EventArgs) Handles MyBase.Load
		Dim Button As New Button With {.Text = "Right", .TextAlign = ContentAlignment.MiddleRight}
		AddHandler Button.Click, Sub() If Button.RightToLeft = RightToLeft.Yes Then Button.RightToLeft = RightToLeft.No Else Button.RightToLeft = RightToLeft.Yes
		Controls.Add(Button)
	End Sub
End Class

r/visualbasic • • Nov 09 '21

VB.NET Help How do i bind a textbox and a combobox to different tables in the same dataset?

6 Upvotes

I have a combobox and a textbox bound to a dataset. I want the choice in the combobox to show the related data in the textbox. In the following example, the combobox works as intended. How do i get the textbox to show Table 1.Column 2?

Public Class Form1
	Private Sub Form1_Load(Sender As Object, Arguments As EventArgs) Handles MyBase.Load
		Dim DataSet As New DataSet
		Dim Combobox As ComboBox
		Dim Textbox As TextBox

		DataSet.Tables.Add(New DataTable("Table 1"))
		DataSet.Tables("Table 1").Columns.Add("Column 1")
		DataSet.Tables("Table 1").Columns.Add("Column 2")
		DataSet.Tables("Table 1").PrimaryKey = {DataSet.Tables("Table 1").Columns("Column 1")}
		DataSet.Tables("Table 1").Rows.Add(1, "A very good year")
		DataSet.Tables("Table 1").Rows.Add(2, "What was the question again?")

		DataSet.Tables.Add(New DataTable("Table 2"))
		DataSet.Tables("Table 2").Columns.Add("Column 1")
		DataSet.Tables("Table 2").Columns.Add("Column 2")
		DataSet.Tables("Table 2").PrimaryKey = {DataSet.Tables("Table 2").Columns("Column 1")}
		DataSet.Tables("Table 2").Rows.Add(17, 1)
		DataSet.Tables("Table 2").Rows.Add(42, 2)

		DataSet.Relations.Add(New DataRelation("Relation", DataSet.Tables("Table 1").Columns("Column 1"), DataSet.Tables("Table 2").Columns("Column 2")))

		Combobox = New ComboBox With {.DataSource = New BindingSource With {.DataSource = DataSet, .DataMember = "Table 2"}, .DisplayMember = "Column 1"}
		Textbox = New TextBox With {.Location = New Point With {.X = Combobox.Location.X + Combobox.Size.Width, .Y = Combobox.Location.Y}}

		'Textbox.DataBindings.Add("Text", New BindingSource With {.DataSource = Combobox.DataSource, .DataMember = "Relation"}, "Column 2")

		Controls.Add(Combobox)
		Controls.Add(Textbox)
	End Sub
End Class

r/visualbasic • • Nov 08 '21

VB.NET Help Looking for visual basic tutor for accelerated university course between December 27th - January 15th

6 Upvotes

Hello! I dropped a university course that I have to take over winter now at an accelerated pace, and am looking for an experienced VB user to help tutor. Work will be done through VB.Net on Visual Studio, all using Windows Forms I believe.

Course structure is professor teaches an analogous problem and shares code for it, and then assigns a weekly project that uses the concepts taught in the analogous problem. I'm looking for someone that can work with me when I write the code for the project and teach me what to do based off the analogous problem.

I think it will require 1-2 sessions a week. DM me if interested and let me know your hourly rate.

Thank you so much!


r/visualbasic • • Sep 13 '21

Tips & Tricks Is there a way to make labels appear a certain way just for the developer but not to the user without having to use code to hide it?

6 Upvotes

Working with labels that are invisible because they will be determined by code or by user input is tricky because you cannot see them. I know I could give them backcolors or fill them with text and then code that to go away right away upon loading the form but this seems inelegant and also like another developer might not understand why I did that.

Is there any way to give controls an appearance that only the developer will see and that the user will not without having to just set the usual user-visible properties and code over it when loading the form?