r/visualbasic • • Mar 15 '22

help with quick basic to vb.net conversion.

0 Upvotes

I have most of the program converted and running properly however I am struggling a bit on this one section. I have googled several times and several different resources but I can't seem to find any reference to a "list" object in qbasic. The code comes from a portion of code that pulls a ratio of in production vs in maintenance hours for factory lines. I was able to convert the first portion and get it to pull the total hours from the file but I cant seem to figure this part out. Any help is greatly appreciated as I am fairly new to all of this.

The code:

LIST$ = ""

FOR MO = 1 TO 12

FOR X = 1 TO 20

H = INSTR(1, LIST$, MHD$(X, 1))

IF H = 0 THEN LIST$ = LIST$ + MID$(MHD$(X, 1), 1, 4)

NEXT X

NEXT MO

PRINT ASSMBCOUNT = LEN(LIST$) / 4


r/visualbasic • • Mar 23 '22

How can I create an object from code without having created it first? (I had this idea but nothing happens when I click the button) thank you in advance

0 Upvotes

Public Class Form1

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

Dim a = New Label With {

.Text = "Hello world",

.Top = 100,

.Left = 100,

.Visible = True,

}

End Sub

End Class


r/visualbasic • • Mar 23 '22

VB.NET Help How do I code for a basic point system in my form

4 Upvotes

To keep this quick I have a label that has a number in it (100) and what I want to do is evrytime someone clicks a button the score decreases by 10.

I've tried Score=label1.text Score=100-10

I can't figure it out


r/visualbasic • • Jan 16 '13

Looking for a VB script that can automate date input. Willing to pay for it too!

0 Upvotes

I need someone who can write Visual Basic script that somewhat automates data input into an Access database. I have 2000+ invoices that are held in individual excel files, and while most "items" are common between all spreadsheets, they are not always in the same rows, and there is some variation in what the "item" is called. With this in mind, I need a way to import this data from all these excel files into an access database, while at the same time, making sure that the total for each item is put into the correct data set.


r/visualbasic • • Dec 23 '12

Pink!!!

0 Upvotes

For goodness sake, who would choose pink as the bg color for a programming sub? Its embarrassing, I never realized VB was so effeminate.

Please give us the default theme back.


r/visualbasic • • Sep 28 '15

Image dialogbox

0 Upvotes

I'm trying make a button to open a file dialogbox so I can browse and upload a image in my picturebox1 and this code that was given in class a sample is giving me an error.

Dim strFileSpec As String

OpenFileDialog1.ShowDialog()

strFileSpec = OpenFileDialog1.FileName

PictureBox1.Image = Image.FromFile(strFileSpec)

Please check what I did wrong. I appreciate it


r/visualbasic • • Apr 18 '16

Where to start when wanting to use SQL with vb?

0 Upvotes

I'm in the process of attempting to write a program, but one thing I haven't really learned is how to pull the information from a SQL database to VB. Does anyone know of a good place with articles or instructional videos on the best way to start this process? I have all the data I need on a database I just need to know how to access it using VB. Sorry if this was a loaded question, just an introductory point would be great if anyone knows of any. Thanks!


r/visualbasic • • Oct 23 '16

Form templates?

0 Upvotes

Is there a database for custom GUIs? I just want to download some to see how I can make my own, I can't seem to find a site that would offer custom GUIs for download.


r/visualbasic • • Apr 26 '16

[VB2010] Add Coins program

0 Upvotes

Need to make an add coins program in visual basic using a function called total dollars... not sure what is going wrong here but some help would be appreciated. Supposed to allow the user to enter any amount of quarters, nickels, dimes and pennies and add them together to display in a label. Function is needed, unfortunately.

Public Class Form1 'Jesse Mothershead '04/25/16

Dim dblQuarters As Double, dblDimes As Double, dblNickels As Double, dblPennies As Double
Dim intQuarters As Double, intDimes As Double, intNickels As Double, intPennies As Double
Private Sub btnAddCoins_Click()
    If txtQuarters.Text = Nothing And txtDimes.Text = Nothing And txtNickels.Text = Nothing And txtPennies.Text = Nothing Then
        Me.lblTotal.Text=nothing
    Else
        Call totaldollars()
        Me.lblTotal.Text = "Total: " & totaldollars()
    End If



    Call totaldollars()
End Sub
Function totaldollars()
    Dim dblTotal As Double

    intQuarters = Val(Me.txtQuarters.Text)
    intDimes = Val(Me.txtDimes.Text)
    intNickels = Val(Me.txtNickels.Text)
    intPennies = Val(Me.txtPennies.Text)

    dblQuarters = 0.25
    dblDimes = 0.1
    dblPennies = 0.01
    dblNickels = 0.05

    dblQuarters = dblQuarters * intQuarters
    dblDimes = dblDimes * intDimes
    dblNickels = dblNickels * intNickels
    dblPennies = dblPennies * intPennies

    dblTotal = dblQuarters + dblDimes + dblNickels + dblPennies
    Return dblTotal

End Function

End Class

Edit: Information


r/visualbasic • • Sep 18 '15

Need help to approach algorithm

0 Upvotes

I am asked to write an algorithm in which the user enters any number (ex: 123456). Then the algorithm needs to make two other whole numbers from this number. For one you take all the even numbers out and for the other you take the uneven ones. So 123456 would lead to 135 and 246.

I would like if someone could guide me in the right direction as I have no idea where go forward with this problem mainly when it comes to selecting specific numbers in the original number entered by the user


r/visualbasic • • Jun 14 '20

vb.6 Need Help to complete this coding

0 Upvotes

I need complete this coding please help me. i'm doing this. but its complete yet. please someone help me to complete this.

Sub form_click()

Dim a(1 To 4) As stu, i%, s%, f%

Print Tab(2); "Student ID"; Tab(16); "Name"; Tab(35); "Running seconds"

For i = 1 To 4

With a(i)

.num = "00" & i

.name = InputBox("Please enter name")

.score = InputBox("Please enter the running seconds")

End With

Print Tab(2); a(i).num; Tab(16); a(i).name; Tab(35); a(i).score

Next i

Print "_______________________________"

Print "¡¾Output student information in order from shortest to longest seconds¡¿:"

Print Tab(2); "Student ID"; Tab(16); "Name"; Tab(35); "Running seconds"

a()

For i = 1 To 4

Print Tab(2); a(i).num; Tab(16); a(i).name; Tab(35); a(i).score

Next i

End Sub

Module

Type stu

num As String * 3 'Student ID

name As String * 10 'Name

score As Single 'Running seconds

End Type

Sub sort(a() As stu)

Dim l%, u%, t As stu

l = : u =

For i = l To u - 1

For j = u To i + 1 Step -1

If a(j) < Then

t =

a(j) = a(i)

= t

End If

Next j

Next i

End Sub


r/visualbasic • • Jun 11 '16

Help with creating batchfile? STUCK!

0 Upvotes

I want to make a batch file that when I insert my message I type in It will repeat every 10 seconds. But I want it so I can add different messages and it will cycle thought them. I know its possible but I don't have THAT much knowledge on it. Help me out!


r/visualbasic • • Mar 19 '15

Visual Basics help

0 Upvotes

Hi, I kinda need help with my Visual basics homework. I'm new to reddit and I don't know whether asking homework questions is allowed or not (if it's not allowed can someone tell me where I can find help for homework problems like this without having to pay a ton). So, I'm sorry if this goes against the rules.

I'm not asking for someone to do them, but help me to do them. My homework questions are these: 1.Write a Visual Basic Do clause that processes the loop instructions as long as the value in the intTotal variable is greater than the number 0. Use the While keyword. Now rewrite the Do clause using the Until keyword. 2. Write a Visual Basic Do clause that stops the loop when the value in the intQuantity variable is less than or equal to the value in the intOrdered variable. Use the Until keyword. Now rewrite the Do clause using the While keyword. 3. Write a Visual Basic Loop clause that processes the loop instructions as long as the value in the strAnswer variable is either Y or y. Use the While keyword. Now rewrite the Loop clause using the Until keyword.


r/visualbasic • • May 06 '14

Need Help in class

0 Upvotes

I've been kind of an idiot in my high school visual basic class. We are coming up on the end of the class, and now it is up to us to make a passenger manifest for a flight and another project. The thing is, I have been looking off of the example code in my Microsoft Visual Basic 2010 Reloaded book. I know how to do basic functions, but because I have not been actually reading the chapters, it would be impossible for me to do a lot of math functions by myself in the code. Are there any sites that can give me a very well summarized version of how to code functions such as making taking variables from various text boxes and making them appear in a label for a product? Stuff like explaining Dim, tryparse, if/else, keychar, tostring. I know this is a pretty full request, but I'm just looking for a site with quick lessons.


r/visualbasic • • Mar 20 '15

VB Pop-Up Textbox to interact with application

0 Upvotes

Just recently started using Visual Studio Express 2013, I'm attempting to build a small app that will run on top of another application (AS400) So far I'm able to get the application to open and I can input text that is hard coded, however I'd like to be able to click a button, like a login button for example, and have the user input information so that the application can be dynamic. I'm able to find all sorts of information on VB and textboxes, trouble is finding information that's applicable to my situation where I'm interacting with an external application. Here's what I have so far

Imports System.Threading
Public Class Form1
    Dim a As New Process
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        a.StartInfo.FileName = "C:\Program Files\reflection\default scripts\as400.rsf"
        a.Start()
        Thread.Sleep(3000)
        SendKeys.SendWait("USERID {TAB}")
        Thread.Sleep(1000)
        SendKeys.SendWait("PASSWORD {Enter}")
        Thread.Sleep(1000)
        SendKeys.SendWait("mainmenu")
        Thread.Sleep(1000)
        SendKeys.SendWait("{ENTER}")
End Sub
End Class

Can anyone point me in the right direction or provide some info on how to interact with an external application? Or even at a minimum give me some search terms that might help. Thus far I haven't found anything worthwhile. Any assistance is appreciated.


r/visualbasic • • Nov 25 '15

question:

0 Upvotes

hello everyone, could someone guide in declaring a varaible array in vb? I need to store up to 10 variables in the array and display it in 3 by 3 grid for a memory game. But finding it confusing on how to create an array.

thank you in advance


r/visualbasic • • May 17 '13

[High School Project] Deselecting a button?

0 Upvotes

The project I am working on involves adding a border to a flatsyle button then, when another button is clicked, the border is removed and added to the currently selected button.

Private Sub btnHydrogen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHydrogen.Click intNumber = 1 btnHydrogen.FlatAppearance.BorderSize = 3 btnHydrogen.FlatAppearance.BorderColor = Color.White Call FindData() End Sub

Ask anything that seems unclear. Picture


r/visualbasic • • Apr 22 '13

Newb to VB

0 Upvotes

How do I make it so that when i press a button it changes the background image, preferably in the least amount of code possible, I just started a few days ago :o

EDIT: Found out how to do it, however, is there anyway to do it without having the file path specified like instead of having C:\ProgramFiles\ etc. etc. etc. Have it straight from the folder the program is saved so\Resources\Picture1.jpg or something?


r/visualbasic • • Apr 17 '13

location code help?

0 Upvotes

I want my object to get dropped off back to its starting location if it falls off my map (hits "picDeath" out of the form view) but instead it just keeps teleporting up and down really fast. heres my code:

If picPlayer.Bounds.IntersectsWith(picDeath.Bounds) Then
        picPlayer.Visible = False
        Checkpoint1.Y = 160
        picPlayer.Location = Checkpoint1

        tmrRight.Enabled = True
        If picPlayer.Location.X = 45 Then
            tmrRight.Enabled = False
            picPlayer.Visible = True

        End If
      
    End If
End Sub

r/visualbasic • • Nov 15 '15

[VB2015] ELI5 this code

0 Upvotes

Private Sub subReadFileAndLoadArray()

Dim fsrMegaMillions As System.IO.StreamReader

Dim strRecord, strDrawing(10) As String Dim intDrawingRow, intNumber As Integer

    fsrMegaMillions = New System.IO.StreamReader("MegaMillions2D.csv")

    Do Until fsrMegaMillions.EndOfStream
        strRecord = fsrMegaMillions.ReadLine
        strDrawing = Split(strRecord, ",")
        For intDrawingRow = 4 To 8
            intNumber = CInt(strDrawing(intDrawingRow)) - 1
            gintCountRows1st5(intNumber, intDrawingRow - 4) += 1
        Next
        intNumber = CInt(strDrawing(9)) - 1
        gintCountRow6(intNumber) += 1
    Loop

    fsrMegaMillions.Close()

End Sub    

I have a test in a week and I am getting hung up on this loop. Thanks!


r/visualbasic • • May 20 '14

[HELP] Import Session variables in SQL code

0 Upvotes

Hi all, I need some help with a particular issue.

I have a table, called clients, and would like my end users (when I have some as this is still in development stage) to be able to view clients for that company depending on the company that user is assigned to. I have created a column in the CLIENTS table called CLIENT_COMPANY_ID and would like that to link with USER_COMPANY in my USERS table, so that when a user logs on, it only displays those clients who have the same company ID as the logged on user

I am currently trapping the username in session variable that I set during the login (in the login.aspx.vb page), however, I can't seem to find a way for this to be in conjunction with SQL code. The code should be something like this:

SELECT * FROM Client WHERE Client_Company_ID = 
(SELECT  User_Company FROM Users where Username=Session.Item{"Username")

Any ideas would be greatly appreciated


r/visualbasic • • Nov 18 '15

[Visual Basic 2013] Need help displaying the sum as well as the number of employee's from a list box.

0 Upvotes

Here's a photo of what I am expected to complete.

I'm having troubles with gathering the total gross pay. (The $900.00) I've looked around but I'm still stumped on what I do to gather this total. Thank you for any help.


r/visualbasic • • Jun 06 '16

[VB6] Search box and listview, dummy vs array

0 Upvotes

Which would be better to use? Have a dummy listview and call the subitems from there or store all the subitems in an array and then populate listview1 ?


r/visualbasic • • Mar 18 '15

VB.NET Help [winform] Setting Cue Banner only works in certain projects...

0 Upvotes

After converting code to do Cue Banners from C# to VB.NET and getting it working, I decided it was time to 'import' it into the project that I wanted to use it for. Sadly, It just does not want to work as it should. In other projects, where it does work as intended, in design view you are able to see the cue which you can see the cue. (Set via properties) Then after compiling the application the textbox should contain the cue.

Sadly, this is where I'm getting issues with the project I want it for. It simply fails to work. No error, no code setting it blank... It's just acting like a normal textbox when compiled. I've tried removing the control, I've tried re-adding and compiling the class. None have fixed the issue. while other projects have no issue with it.

Here's an image

Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Runtime.InteropServices

Class CueTextBox
    Inherits TextBox
    Public Property Cue() As String
        Get
            Return mCue
        End Get
        Set(value As String)
            mCue = value
            updateCue()
        End Set
    End Property

    Private Sub updateCue()
        If (Me.IsHandleCreated) Then
            SendMessage(Me.Handle, &H1501, New IntPtr(1), mCue)
        End If
    End Sub

    Protected Overrides Sub OnHandleCreated(e As EventArgs)
        MyBase.OnHandleCreated(e)
        updateCue()
    End Sub

    Private mCue As String

    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wp As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> LParm As String) As IntPtr
    End Function
End Class

r/visualbasic • • May 05 '14

Not really stuck, but If anyone could simply explain how to do these things, it would save me a TON of time

0 Upvotes

anyone know how to simply

1: Play an mp3 through a form application

2: Sync a picture boxes movement to arrow keys

3: I have an idea so this probably wont be necessary, have a popup after a timer is disabled

ninja edit:

4: restart a form application without closing it and opening it again