/r/visualbasic

Photograph via snooOG

A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages.

/r/VisualBasic - A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages.

Please up vote anybody who helps with your submission, we want people to keep answering questions.

Tips & Guidelines

  • Please prefix your posts with the version of Visual Basic you are using. Example: [VB2010] - [VB2015], [VB6], [VBSCRIPT], [VBA]
  • Posting any code you have will help others better understand what you are trying to do and what you have tried already, even if it doesn't work properly. It also shows that you already tried to solve your problem.
  • If you ask for help, you should come back and let us know how things turned out.
  • Homework questions are tolerated, please be specific about the question as much a possible. Asking us to write it for you is not going to happen. We also reserve the right to not answer if we think you are just not trying.
  • Tell us what you have tried, to help us give better answers?

Communities

Resources

Learning Visual Basic

Related Subreddits

/r/visualbasic

9,116 Subscribers

3

RWRUN60 CMD failure

Hi, My employer upgraded Oracle from 11g to 19c.Now the Oracle forms builder fails to connect to Oracle 19c.RWRUN60 CMD just vanishes once the creds are entered and nothing happens.

Anyone has any experience with this and any suggestions or fixes for this?

Forms builder 6i was earlier connecting to 11g and everything was working fine.

Please let me know if any additional info is needed from my end.

I have no knowledge or experience on VB.So seeking out for help

They thought it has to do with encryption in 19c and altered the sqlnet.ora file to setting LOGON.ENCRYPTION=rejected but dint help

1 Comment
2024/11/08
19:25 UTC

6

Vb to mobile

Hi guys! I've made a program for my dad that he can know how many hours he made at job. But I don't know how to transfert my program to a phone. Can you help me? I do so many search and I can't find anything. I think that I can't do this, so please don't juge me about this. I'm with visual studio 2022, NET8.

Sorry if my english is bad, I'm learning. I hope that you can understand. Thank you!

9 Comments
2024/11/06
22:56 UTC

1

need help withinput validation

I have this button set up to increase an int value when clicked and decrease when you press shift and the button. It then displays the amount in a label. I'm trying to figure out how to prevent it from going below 0. As I currently have it, it drops to a negative number then display the message box. Any thoughts how I can make this work?

 If OGeneralT >= 0 Then

     If My.Computer.Keyboard.ShiftKeyDown Then
         OGeneralT -= General
     Else
         OGeneralT += General
     End If

     lblOGeneral.Text = OGeneralT

 Else
     MessageBox.Show("Number can't be less than zero")
     OGeneralT = 0

 End If
7 Comments
2024/11/06
19:41 UTC

5

Hourly rate B2B contract for VB 6?

Hello VBers!
I was contacted by a recruiter from Capgemini for a mid-role I will paste some of the insights as the text is long.

I was just offered 32 euros per hour (B2B). I live in Romania and I have done a Bachelors here, and a Master's in Switzerland, but I have only a year of experience. The job is for a senior role, so I guess that I will be "sold" like that. Now I would like to counter it, and ask for more. I am thinking of 55 euros/hour (as the technology is old and many avoid it), is it too much? Now I have a very stable job as a .NET developer, but I don't earn that well, I get 1250 euros/month.

Also, if I am fired I have where to live and I have an small extra income flow, so I can still survive.

Thank you all guys, for your time to read this long text and even reply! Appreciate it.

___________________________________________________________________________________________________________

Join our dynamic team to work on a cutting-edge banking project for one of Europe’s largest financial institutions.

MAIN TASKS AND RESPONSIBILITIES

- Design, develop, and maintain backend services and APIs to support various banking

functionalities.

- Collaborate with cross-functional teams to define, design, and ship new features.

...

- 6+ years of experience in software development

- Experience with Visual Basic 6

6 Comments
2024/11/04
09:08 UTC

1

Object reference not set to an instance of an object - please help

This VB script is reading text field values being fed from a table, which are coming from an XML file. The values are constantly changing and the XML file is being re-written and the data table is constantly updating the text fields.

I keep getting an error in the application running the script. "Script 'ElectionFS_404' Error Line 7: Object reference not set to an instance of an object". The line this error is occurring is

If Input.Find("results_40").Text("Winner2Mark.Text") = "W" then

Sometimes the loop will run fine for 2 hours, other times it will error out in 3 minutes. I am about to lose my mind trying to figure out what to do with it. I assume the issue is when the XML file or data table is being updated, the text fields are temporarily blank or unavailable. If I immediately restart the script, it will run fine again for some time, then error out again on the same line. I have a couple of similar scripts that all error out on that first If line.

It doesn't seem to care if the field is empty as it errors out even when the "W" is present.

Is there a way to handle this in a way that causes it to ignore the error or start over again?

I'd appreciate any type of feedback or hints as to what I can add or subtract to stop this error. Thank you all for checking out my post. Here is the script -

Dim W, fswinmrk2, fswinmrk1, results_40, ElectionFS_40 As String

Do While True

If Input.Find("results_40").Text("Winner2Mark.Text") = "W" then
API.Function("SetMultiViewOverlay",Input:="ElectionFS_40",Value:="9,fswinmrk2")

Else If Input.Find("results_40").Text("Winner1Mark.Text") = "W" then
   API.Function("SetMultiViewOverlay",Input:="ElectionFS_40",Value:="9,fswinmrk1")

Else 
     API.Function("SetMultiViewOverlay",Input:="ElectionFS_40",Value:="9,none")

End If
Loop
10 Comments
2024/11/02
20:12 UTC

3

PrintDialog1.PrinterSettings.SupportsColor Not Working

Hi guys, I had some trouble with PrintDialog1.PrinterSettings.SupportsColor. When I set my printer with with PrintDialog1.PrinterSettings.PrinterName, I should get that the printer doesn't support colors, but it says that it does. Why? If a try to use the PrintDialog1.ShowDialog(), it knows that the printer can't use colors but the command says it can. I hate this. I even tried with the PrintDocument, it doesn't work, either. Can you guys please help me?

6 Comments
2024/11/01
15:26 UTC

1

Integers across forms

I'm trying to make a casino with multiple forms, but I don't know how to carry an integer for a money amount from one form to another (example: from the lobby form to the bar table form). Does anyone know how to do this?

2 Comments
2024/10/30
19:23 UTC

2

Crash course on VB/asp.net?

I need to quickly study source code of a working legacy project built with VB and asp.net (and a MS SQL Server db), figure out what all the core modules/procedures are and what they do, and turn it a Python FastAPI backend for a future website and mobile/desktop app. I'm a Python/JS dev and have no idea of VB or dotnet.

What would be the best way to approach this? Where should I start? Any resources that can help me with this?

17 Comments
2024/10/28
01:40 UTC

21

VB6 alternatives today?

Hi Guys,

Back in the 90s I used code a lot in VB5 and then VB6. It was great. Drag and drop elements on a form. Do some coding. Nothing fancy. I used to make small programs to do simple things. It was great fun building these desktop apps for Windows 9x.

Now I want to get back into this kind of development. Is there any similar solutions these days? Something very very similar and if it's for Mac and somehow can make the "app" into a web app as well, that would be great. Otherwise just desktops for Windows is also fine.

Looking forward to hearing from you all.

46 Comments
2024/10/22
04:54 UTC

1

Issue in color conversation using ghostscrript

Hi all, in my application, I am using Ghostscript to convert RGB to CMYK in a PDF. The conversion works, but I can't control the CMYK values from the RGB input. For example, the expected black CMYK value is 0/0/0/100, but the actual values are different. Does anyone have an idea on how to control this from HTML, or know of any plugin that can control the CMYK values? Alternatively, is there a way to control Ghostscript directly

0 Comments
2024/10/20
17:56 UTC

0

What’s the difference between Visual Basic and C?

9 Comments
2024/10/19
04:48 UTC

2

Trying to draw lines in a picture control

Nothing happens. Scale is in twips. picMain is the picture control. It should draw an horizontal line in the middle.

Private Sub Form_Load()
    x1 = PixelCoordX(picMain.Width, 50, -50, 100)
    y1 = PixelCoordY(picMain.Height, 50, 0, 100)
    x2 = PixelCoordX(picMain.Width, 50, 50, 100)
    y2 = PixelCoordY(picMain.Height, 50, 0, 100)
    DrawLine picMain, x1,  y1, x2, y2
End Sub

Function PixelCoordX(PictWidth, OffsetX, xCoord, FOVx)
    PixelCoordX = PictWidth * ((OffsetX + xCoord) / FOVx)
End Function

Function PixelCoordY(PictHeight, OffsetY, yCoord, FOVy)
    PixelCoordY = PictHeight * ((OffsetY + yCoord) / FOVy)
End Function

Function xCoord(PixelCoordX, PictWidth, FOVx, OffsetX)
    xCoord = PixelCoordX / PictWidth * FOVx - OffsetX
End Function

Function yCoord(PixelCoordY, PictHeight, FOVy, OffsetY)
    yCoord = PixelCoordY / PictHeight * FOVy - OffsetY
End Function

Sub DrawLine(object, x1, y1, x2, y2)
    Debug.Print x1, y1, x2, y2
    object.Line (x1, y1)-(x2, y2), RGB(0, 0, 0)
End Sub
1 Comment
2024/10/13
21:04 UTC

3

VB5 on Win98. How do I code DirectX stuff? Graphics and sound

I have been wondering how do I code two simple rotating pyramids in VB5 while playing some audio. I want to learn to code games. I am using enterprise edition. Help and books online show nothing about directx usage. Dxdiag shows DirectX 9.0c

24 Comments
2024/10/13
19:59 UTC

2

Looking for someone in Arizona that can help me install VB 6 on my laptop.

I live in Casa Grande, AZ. Looking for someone who can help me get VB 6 installed on my laptop.

7 Comments
2024/09/30
20:00 UTC

3

Looking for help with a vb6 project

A client has a VB6 project that they want to make some changes to. After I installed Visual Studios on my laptop, I realized that it would not work on this project. I think I need to install VB6. I went to source forge but not sure what to install. Need some help with what to install and uninstall on my laptop.

23 Comments
2024/09/29
02:42 UTC

2

Reports pdf

Hi, I’m trying to find a reporting designer like a “Microsoft Report builder” but open-source and free. Does any one use something similar? I need to generate a pdf using a html template or similar (for easy designing) and export it. We work with vb6 and asp.net. The company where I work actually have his own system with xml, but it’s only coding and you can’t see the design until you run all the project.. now we are looking for something more visual, drag and drop elements into a template etc.

Any ideas? Thank you in advance

11 Comments
2024/09/28
07:25 UTC

2

[VB.NET]MSXML loadxml() method issues

I'm not a programmer, I just build some tools to tie into our proprietary software at work; so please be patient with me.

I'm handling a web API response that is returning xml in the following format:

<?xml version="1.0" encoding="utf-8"?>
<xml>
<status>1</status>
<count>1</count>
<scan id="354073453">
	<tid>G24J2305100A</tid>
	<result>23011041</result>
	<timestamp>2024-09-26 12:31:29</timestamp>
</scan>
</xml>

My code is as follows:

result = objHTTP.responseText  <this is the xml from above
xmlfile = New MSXML.DOMDocument
xmlfile.loadXML(result)

When I look at the contents of xmlfile, I see the following:

G24J2305100A230110412024-09-26 12:31:29

Here's my problem, I need the scan id, and it's being ignored when I load the result string into the xml file. Before I dump this into a regex to get the values I need, I want to know if here is a way to just do this with the existing xml.

3 Comments
2024/09/27
17:18 UTC

3

I need a project idea

I need a project idea and my profeesor is kinda strict if you guys have any idea for a vb project please let me know

Thanks in advance

14 Comments
2024/09/27
04:53 UTC

6

Whats the difference between my code and the correct code?

One says declaration error in visual studio but i already declared. in the coe before this

this is the correct one

If bmi < 18.5 Then

category = ("Underweight")

ElseIf bmi >= 18.5 And bmi < 24.9 Then

category = ("Healthy Weight")

ElseIf bmi >= 25 And bmi <= 29.9 Then

category = ("Overweight")

ElseIf bmi >= 30 Then

category = ("Obese")

End If

and this is my code

if bmi < 18.5 Then

category = ("underweight")

ElseIf bmi >= 18.5 And bmi < 24.9 Then

category = ("Healthy Weight")

ElseIf bmi >= 25 And bmi <= 29.9 Then

category = ("Overweight")

ElseIf bmi >= 30 And bmi Then

category = ("Obese")

End If

13 Comments
2024/09/26
03:14 UTC

1

I need help with a random message generator

I am trying to make it so that when I press a button, a random number generator picks a number between 1 and 55, and depending on what number it picks, a different message will appear on a label. Does anyone know how to do this?

10 Comments
2024/09/25
16:12 UTC

2

Best cloud based database for VB Project

I’m working on a project that will require the user to login to the system. I want this to go out to a cloud based SQL database system to verify the username and the password(will be stored as a hash) I got it working with AWS MY SQL but I wanted to add certain triggers to the database that I guess I can’t add since the way Amazon sets up the RDS system they don’t make your user a super user and there is no way around this. I’m wondering which database system would work best for my VB.NET project.

8 Comments
2024/09/24
09:47 UTC

1

Another "Install on Win 10/11" but I am stuck with Sheridan Data Widgets 3

After following the various guides to get VB6 installed, I have it working on Win10, but like the title says, I cannot get the Sheridan Data Widgets to install properly and be available at design time in VB.

Has anyone had any luck with that, and have any suggestions and how to get it working?

I do all my work in maintaining our old software via an old Win7 VM and would love to be able to run everything natively on Win10/11.

13 Comments
2024/09/24
03:29 UTC

4

Trying to get Visual Basic 6.0 installed on Windows 11

I have now tried for several days and tried way too many different sites and possible fixes and i am completely running out of ideas.

The roadblock came swiftly and with force: Windows 11 prevents starting the Setup.exe file completely due to compatibility issues. The exact message is this: "This app may not work correctly"

I can either cancel or open microsofts help page which is honestly quite useless.

I tried every compatibility option, ran it as administrator, tried disabling the compatibility checker in the group policies, ran the system without other startup programs in a clean boot.

I never came past this single popup window.

With more searching i found that someone made an alternative installer: https://nuke.vbcorner.net/
But with the original authors passing this site is relatively dead it seems and i was not able to track down any mirrors of the program in the hopes of it being able to be executed.

All i am able to find is other people having issues with the installation process itself, not starting the executable itself.

I tried the original discs i have as well as other language isos i stumpled accross, none came past this message.

If you guys have any ideas i would be really grateful, i tried it on 3 different, but equally equipped windows 11 machines now and it did not work on any of them.

Edit:

After trying on a random win 11 laptop i had it did install just fine from my original cd. I still got the popup but the installer ran successfully.
So it seems to be a device specific issue leading to a problem without any errors.

I did not create a zero size dll or did anything else, only ran the compatibility mode changer and it worked.

Edit Nr 2.:

On the 5 main pcs i wanted to actually install it on i was not able to get it to work, but in case someone else stumples across this someday here is what i tried:

Exact behaviour is that it fails to even start the installer. When running it through WinDbg it exits with error code 5 access violation, the same error we can see in the event log.

I have not been able to get around this and i am starting to suspect its due to a random program that is installed, but i have not yet found the culprit.

Disabling windows defender did not work.
Neither did turning off exploit protection.
A silent install through the command line fails with error code 5, what that error code means is unknown, there isnt really much documentation about a silent install of VB6.0.

None of the different version of VB had a setup that worked for me. Sadly the VS6Installer did not work as well as it also needs to be able to run the setup.exe.

Clean booting windows also failed.

I am not willing to do it, but i suspect a clean windows install without any possibility of bloatware or preconfiguration could be a solution.

34 Comments
2024/09/23
11:16 UTC

3

Most used version of .Net Framework

Hi, I have a question for all the vb.net devs, which version(s) of .net do you typically or most frequently target for your apps and why? Personally I'm typically using .Net 4.0 for most projects. I've been noticing that the more recent versions just give some syntactic sugar. I don't see anything noteworthy beyond that.

8 Comments
2024/09/23
03:17 UTC

3

Need Help in Printing PDF File

Right now i am printing pdf file using PrintDocument, the problem is to be able to print the pdf file i am converting the pdf file into images first using ghostscript then i will print the image using PrintDocument, is there a way to print the pdf directly?
I am not using AxAcroPDF because i have two printers, one for letter size and one for legal size and i dont think AxAcroPDF has an option to specify printer

Private Sub ConvertPdfToImages(pdfPath As String, outputDir As String, fromPage As Integer, toPage As Integer)

Using rasterizer As New GhostscriptRasterizer()

rasterizer.Open(pdfPath)

For i As Integer = fromPage To toPage

If i > rasterizer.PageCount Then Exit For

Dim img As System.Drawing.Image = rasterizer.GetPage(300, i)

Dim outputFilePath As String = Path.Combine(outputDir, $"page_{i}.png")

img.Save(outputFilePath, ImageFormat.Png)

img.Dispose()

Next

End Using

End Sub

Private Sub PrintImage(imagePath As String, printerName As String, isLetterSize As Boolean)

Dim printDoc As New PrintDocument()

printDoc.PrinterSettings.PrinterName = printerName

' Set paper size based on isLetterSize

If isLetterSize Then

printDoc.DefaultPageSettings.PaperSize = New PaperSize("Letter", 850, 1100) ' 8.5 x 11 inches

Else

printDoc.DefaultPageSettings.PaperSize = New PaperSize("Legal", 850, 1300) ' 8.5 x 13 inches

End If

' Set page orientation based on the selected radio button

If rbPortrait.Checked Then

printDoc.DefaultPageSettings.Landscape = False

ElseIf rbLandscape.Checked Then

printDoc.DefaultPageSettings.Landscape = True

End If

' Handle the PrintPage event

AddHandler printDoc.PrintPage, Sub(sender As Object, e As PrintPageEventArgs)

If System.IO.File.Exists(imagePath) Then

Using image As System.Drawing.Image = System.Drawing.Image.FromFile(imagePath)

e.Graphics.DrawImage(image, e.PageBounds)

End Using

Else

MessageBox.Show($"Image file not found: {imagePath}")

End If

End Sub

' Set print settings to grayscale if needed

printDoc.DefaultPageSettings.Color = False

' Print the document

printDoc.Print()

End Sub

2 Comments
2024/09/21
04:15 UTC

2

where can i get learning materials to start learning.net framework?

1 Comment
2024/09/20
02:29 UTC

3

VB COM component registration with COM+ app

Hi

I am new to visual basic. We have few visual basic Service components of library type. We are using component services to register all the C++ COM components.

In our old servers I see the registered path for VB.NET COM components as mscoree.dll in component services.

Could you please let me know how to register VB.NET COM components under COM+ apps.

10 Comments
2024/09/17
16:39 UTC

2

Looking for completed files

Does anybody know where I can see completed .sln files pertaining to Zak's Programming used in engage. Specifically VB9e. I'm lost in the sauce and would like to compare my work to accurate completed code. I cannot find anywhere online supporting my request. It is as if there is some community blocking all help behind pay walls and homework help pay sites.

2 Comments
2024/09/17
02:07 UTC

Back To Top