r/visualbasic • • Jan 18 '21

VB.NET Help Can someone help solve this error?

Post image
5 Upvotes

r/visualbasic • • Dec 22 '20

Simple UDP Receiver

5 Upvotes

Hi everyone, I am super noob, i have been using several languages only for solving various problems from art and design point of view, so no real programmer but fairly it knowledgeable.
I am now in need to create a simple tool capable of opening a UDP Socket to listen for messages sent from a machinery that sends something like this:

DATE;21/12/2020
TIME;15:13:43
MODE;NORMAL
UNIT;1
SEQ;6;0
SID;00005
PID;
ID;BORIS
TEST;LMG
OPERATOR;

I have started building something, but I've got stuck as this point

Imports System.Text
Imports System.Net
Imports System.Net.Sockets
Imports System.Reflection

Class MainWindow
    Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        Log.AppendText("Starting" + Environment.NewLine())
    End Sub

    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)

        Dim UDPClient As UdpClient = New UdpClient()
        UDPClient.Client.ReceiveTimeout = 100
        UDPClient.Client.Blocking = False

        UDPClient.Client.SetSocketOption(SocketOptionLevel.Socket,
         SocketOptionName.ReuseAddress, True)
        UDPClient.Client.Bind(New IPEndPoint(IPAddress.Any, 1200))

        Try
            Log.AppendText("Opening Connection" + Environment.NewLine())
            Dim iepRemoteEndPoint As IPEndPoint = New IPEndPoint(IPAddress.Any, 0)
            Dim strMessage As String = String.Empty
            Do
                Log.AppendText("Loop" + Environment.NewLine())

                Dim bytRecieved As Byte() = UDPClient.Receive(iepRemoteEndPoint)
                strMessage = Encoding.ASCII.GetString(bytRecieved)

                Log.AppendText(strMessage + Environment.NewLine())

            Loop While (strMessage <> "END_RESULTS")
            UDPClient.Close()
        Catch ex As Exception
            Log.AppendText(ex.ToString() + Environment.NewLine())
        End Try
    End Sub

End Class

The interface so far (in the future i hope to implement TCP)

Any help is greatly appreciated... Thanks

P.S.
I use netcat to test the tool and send udp messages


r/visualbasic • • Dec 18 '20

Help? I have been working on this for hours and cannot get it to run. The PMT is tripping me up. Please help.

Post image
5 Upvotes

r/visualbasic • • Dec 14 '20

VB.NET Help I'm new to visual basic soo can someone help me out. An explanation would be appreciated!

Post image
5 Upvotes

r/visualbasic • • Oct 06 '20

How to check for certain integers in a textbox.

5 Upvotes

Trying to make a program that will take 10 values from 10 textboxes and add them together.

I've tried "t1.text = Int(1)" But that only works with the number one. How do I make it so it'll check for numbers one to ten?


r/visualbasic • • Aug 18 '20

[Noob] Does variable in Vb.net have concept of address?

5 Upvotes

Im doing my assignment on Vb net, I've been searching on the internet and books, but I can't seem to find anything related to the variable address. I found a question similar to mine in Stack Overflow. Someone replied

we dont. so we cant

in dotnet and java world, the concept of address of a variable is not the same as in C. the way address-of-a-variable is taught is old. the java/dot-net languages are way too advanced. of course the variable exists in memory but the address may not be what you think. so while working in these languages we do not usually consider the address aspect. that is considered only in context of C/C++.

Does this mean Vb net dont have the concept? If so, where does it store the variable?


r/visualbasic • • Jul 23 '20

Where is the best place to learn Visual Basic online for free or cheap?

5 Upvotes

I graduated with a bachelor's in computer engineering this spring and am struggling to find a job. I want to try and take this in stride though and expand my knowledge to make myself more marketable. Is there a good free or cheap class online that I can take on Visual Basic so I can at least become familiar if not confident in using it? I've noticed it come up in a lot of interviews and I want to be able to answer any questions they may have.

Edit: Noted, from most comments apparently C# is the way to go


r/visualbasic • • Jul 16 '20

ASP.NET VB Role Manager (SQL stopped working after enabled)

5 Upvotes

Hi VB Programmers:

I have a web app on my IIS server which is domain connected. I would like to enable role manager so I can use the command If System.Web.Security.Roles.IsUserInRole("DOMAIN\SecGroup1")= "true" Then

so I attempted to place this into my code, but it errored asking me to enable role manager.

After enabling role manager in my web.config file, my SQL connection stopped working.

My SQL connection is simply under ConnectionStrings in web.config which is a string of data source (server name), ID, Password, and provider name.

(Edit: my SQL database has no roles, tables, or anything related to security. I've had this web app for internal use since ASP 2.0 and this was working at one time. I have since moved to ASP 4.0 and then 4.6.1. I just need the ability to verify if someone is a member of AD. Part of my app already reads/writes to AD fields, if that helps.)

What do I need to do to make SQL work again with role provider?


r/visualbasic • • Jun 27 '20

Isnt Visual Basic just CSharp but with a more english like syntax? (Makes it slightly slower to code)

5 Upvotes

r/visualbasic • • May 11 '20

VB program I am working on

5 Upvotes

Hello,

I am working on a VB script that can pull out information about tracked changes in Microsoft Word. If you make a change, the script should be able to figure out where (what page) that change occurred. This I have down, and I modified the code below slightly (I did some Google searches, found this great code, then modified it). However, I also want to make it so the revision at which the change occurred also prints. For example, if you make a change to page 4 on Revision 1.1, the script should print a table with "4" in one column, and "1.1" in the column next to it. Conversely, if other changes are made to page 4 but on revision 1.2, it should then print another line that has "4" and "1.2" on it. This is the part I cannot get working. How would you do this?

https://ideone.com/Ed1wfI


r/visualbasic • • Apr 24 '20

Can't get date to show in file name

5 Upvotes

I am using some VBA from a website to print to pdf and email that email, however I can't seem to get the file name to show the date as the name. Here is the VBA that needs altering.. :

Dim CurrentMonth As String

CurrentMonth = ""

'Current month/year stored in H6 (this is a merged cell)

CurrentMonth = Mid(ActiveSheet.Range("H6").Value, InStr(1, ActiveSheet.Range("H6").Value, " ") + 1)

'Create new PDF file name including path and file extension

PDFFile = DestFolder & Application.PathSeparator & ActiveSheet.Name _

& "_" & CurrentMonth & ".pdf"

So when I input "=today()" into H6 the it will only show the dd/yyyy and it doesn't show the month.. how can I fix that?


r/visualbasic • • Mar 25 '20

How to print/call a variable from a function in a sub.

5 Upvotes

So I have a quadratic equation function which prints 2 variables xpos and xneg. How do I call those two in another sub.


r/visualbasic • • Mar 16 '20

Increase process memory?

5 Upvotes

Hey guys! My friend and I are making a school project in visual studio (with visual basic). We're making a bootleg cookie clicker game. The problem is that the counter can't keep up with our "clicking speed", and therefor some clicks are nor registered. The small process memory graph says maximum of 27 MB (as seen in the picture). Is this the problem or what?


r/visualbasic • • Mar 13 '20

Get drive/partion information including total space, free space, make, model and if SSD or not

5 Upvotes

Hi All,

I'm trying to write a small inventory app that retrieves information about a client and sends it to a remote server. I've managed to find drive/partition information and total space/free space etc but im struggling with make/model and SSD, ideally, it would be nice to get it all at the same time rather than trying to gather from different places but I'm not sure that will be possible.

All help is greatly appreciated, thanks.

Edit: *partition in title, didn't spot it until right as I clicked save :\


r/visualbasic • • Feb 21 '20

VB.NET Help DecryptString and write in plaintext to text file

5 Upvotes

Full disclosure, this is to help with me a coding challenge from HTB that has bugged me for days. Other than a bit of VB 10 years ago I'm a complete newbie.

What do i need to add/edit to the following to get it to decrypt the string and write the result in plaintext to a text file? Grateful for any help.

Public Shared Function DecryptString(pTEzAfYDoz1YzkqhQkH6GQFYKp1XY5hm7bjOP86yYxE=) As String

If String.IsNullOrEmpty(EncryptedString) Then

Return String.Empty

Else

Return Decrypt(EncryptedString, "13st22", "28552299", 2, "364R5DFA5DL6LE28", 256)

End If

End Function


r/visualbasic • • Jan 22 '20

Visual studio says its using a maximum of 8 mb of RAM. Can i change that?

5 Upvotes

I'm trying to learn C#, and im using visual studio. But whenever i run a project, it shows me its usage of RAM and CPU usage. But it only shows that its using a maximum of 8 RAM, And that the project takes forever to run. Is that the actual usage of RAM of visual studio or the project runner?


r/visualbasic • • Nov 05 '19

Study Buddy?

5 Upvotes

In my first semester of programming courses and would like to find someone to study/work with.

I'm located about 30 minutes from Center City Philadelphia. Working remotely is also fine.

The textbook I'm currently using is An Introduction to Programming Using Visual Basic 10th Edition. I also rely heavily on Microsoft documentation and YouTube.


r/visualbasic • • Oct 23 '19

VB.NET Help Coin flipping program

Post image
5 Upvotes

r/visualbasic • • Oct 11 '19

Looking for DopeWars code

5 Upvotes

Hey there. I lurk a lot, but I wanted to see if the community could help me out.

Back in the day, early 2000's, I started programming in Visual Basic 6. I use to have a project I was working on that was a MUD. I got the source code from the game DopeWars because it was open source and I was able to learn and work from there. I still have most of my projects, but I am missing my Client project, So the servers runs but no one can connect XD. I will have to re-create it from scratch :( I don't think there is much of a desire for MUDs anymore, but the project is more what I am interested in. I haven't touched Visual Basic in about 12-13 years, so I want to get my feet wet again.

I was hoping that someone out there had a copy of this bad boy from back in the day that I could get a copy of. I just wanted to fiddle around and now it's driving me NUTS because I have the exe but not the project and the parameters for connection have changed. I KNOW there is a zip disk floating around with my source code on them, but I can't for the life of me find it since I moved.

Thanks to anyone reading this. If nothing else I will start completely from scratch, but I liked having a working code base to play with and learn from.


r/visualbasic • • Sep 17 '19

VB.NET Help Having problems processing body of 400 Bad Request

5 Upvotes

Hi All,

I have an issue that I don't quite know where to go.I'm using a httpwebrequest to post data to a Restful API. Which is mostly working.

If I have a successful post I receive a response from the server without issue as I expect.

If I post an unsuccessful message to the server I get a 400 bad request and am unable to receive the message body which contains the details of the bad request.

I know the bad request has a body as I've been testing with Postman and am getting the body as I would expect.

    Shared Function callToAPI(ByVal urlStr As String, ByVal payload As String, ByVal method As String, ByVal username As String, ByVal password As String) As String
        'https://MACHINE_NAME:13125/sss/api/v2/members/?externalUser=
        Dim response As String = ""
        Dim authHeaderScheme As String = "Basic"
        Dim authHeaderValue As String = password

        Try
            Dim request As HttpWebRequest = HttpWebRequest.Create(urlStr)
            Dim payloadBytes As Byte() = Encoding.UTF8.GetBytes(payload)
            'request.Method = "POST"
            request.Method = method
            request.ContentType = "application/json"
            request.PreAuthenticate = True
            request.Credentials = New System.Net.NetworkCredential(username, password)
            If Not method = "GET" Then
                'Send the data
                request.ContentLength = payloadBytes.Length()
                Dim outgoingDataStream As System.IO.Stream = request.GetRequestStream()
                outgoingDataStream.Write(payloadBytes, 0, payloadBytes.Length)
                outgoingDataStream.Close()
            End If

            'Get the response
            Dim apiResponse As WebResponse = request.GetResponse()

            Using returnDataStream As System.IO.Stream = apiResponse.GetResponseStream()
                Dim reader As New System.IO.StreamReader(returnDataStream)
                Dim responseFromServer As String = reader.ReadToEnd()
                response = responseFromServer
            End Using
        Catch ex As Exception
            'Catch ex As WebException
            response = ex.Message & vbCrLf
        End Try
        Return response
    End Function

r/visualbasic • • May 06 '19

Global Variables Help

5 Upvotes

I’m working on small project for class right now, and I’m having nothing but issues getting global variables to work. What is the easiest way to do this? I have them declared on Form1 as Public and I’m trying to use them on Form2 in order to save a value, then use that value on Form1. Using VisualStudio.

Any help is greatly appreciated!


r/visualbasic • • Feb 07 '19

Form1_Load not working

5 Upvotes

I have the following code in my project:

Private sub Form1_Load(sender as object, e as eventargs) handles mybase.load Msgbox("it worked") End sub

For some reason, this sub is not being called when the program is run. Please help.

(I tried the same code in a new project and it worked fine)


r/visualbasic • • Jan 20 '19

Does adding an item to a list box block an if then

5 Upvotes

I have this if... then statement but for some reason I cant add anything after like an else if or even the end if it tells me it must be proceded by an if

If rbPetit.Checked Then lbFacture.Items.Add("h")

End If


r/visualbasic • • Jan 09 '19

need help on VB quiz game

5 Upvotes

For my computer science coursework I'm creating a movie quote quiz in VB. I'm trying to think what would be the best way of being able to generate questions and the answers option without having to enter each question and answer as a variable within an array. any help would be appreciated.


r/visualbasic • • Dec 11 '18

JSON in VB .NET

5 Upvotes

I am stuck. Can anyone help me?

Problem is this:

I can't get this JSON to parse with newton soft JSON in .net 3.5 This code seems to make it happy but then when it tried to deserialize it crashes.

What is it about the class LEGALLAND that is not quite right?

Public Class LEGALLAND Public success As Boolean Public type As String Public features As Feature End Class

{ "success":true, "type":"FeatureCollection", "features": [ { "type":"Feature", "properties": { "DLSSHORT":"2-2-2-W4", "QUARTER":"", "SECTION":"2", "TOWNSHIP":"2", "RANGE":"2", "MERIDIAN":"W4", "PROVINCE":"Alberta", "COUNTY":"CypressCounty", "LATITUDE":49.093639, "LONGITUDE":-110.173043, "ZOOM":14, "MGRS":"12UWV6037138194", "UTM":"12N5603725438195", "NTS":"B-14-G/72-E-1", "PID":"402002020" }, "geometry": { "type":"Polygon", "coordinates": [ [ [-110.162055,49.086400], [-110.162039,49.100866], [-110.184014,49.100879], [-110.184063,49.086410], [-110.162055,49.086400] ] ] } } ] }