Jump to content

Dim sResult As String = "" Is this were i want to put the text for it to display?

Dim rdm As New Random() is this were i give it a number?

 

No silly it's a function that you can call, here's an example:

Module Module1    Sub Main()        Console.WriteLine(GetRandomString(10)) ' Provide the size as a parameter        Console.ReadKey()    End Sub    Public Function GetRandomString(ByVal iLength As Integer) As String        Dim sResult As String = String.Empty        Dim rdm As New Random()        For i = 1 To iLength            sResult &= ChrW(rdm.Next(32, 126))        Next        Return sResult    End FunctionEnd Module

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
https://linustechtips.com/topic/414915-vb-help/#findComment-5588017
Share on other sites

Link to post
Share on other sites

 

No silly it's a function that you can call, here's an example:

Module Module1    Sub Main()        Console.WriteLine(GetRandomString(10)) ' Provide the size as a parameter        Console.ReadKey()    End Sub    Public Function GetRandomString(ByVal iLength As Integer) As String        Dim sResult As String = String.Empty        Dim rdm As New Random()        For i = 1 To iLength            sResult &= ChrW(rdm.Next(32, 126))        Next        Return sResult    End FunctionEnd Module

thanks. im still confused on were do i put what i want it to display it.

Link to comment
https://linustechtips.com/topic/414915-vb-help/#findComment-5588497
Share on other sites

Link to post
Share on other sites

thanks. im still confused on were do i put what i want it to display it.

 

Well you call it (on the button click event in your case) and then the return value can be assigned to something... such as a text field's text property for instance. Or passed to the console as I did.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
https://linustechtips.com/topic/414915-vb-help/#findComment-5588632
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×