How To Create Random Strings With Parameters
Jan 17, 2012
I would like to make a program that generates a safe passwords for people to use. I want to make the passwords vary in length, include numbers, letters and upper case letters. I've been able to write code that prints out a random string but it includes unrecognized characters for most passwords. How would I write the code to create a random string that has parameters? (in this case upper case lower case letters and numbers).
View 3 Replies
ADVERTISEMENT
Nov 24, 2009
I don't take programming lessons at school or anything, and I'm starting to (try to) teach myself about random things.Currently I'm making an app that has 3 functions:
-Random Integer (1 to 100)
-Random Answer (Yes or No, similar to a coin flip)
-Random Dice Roll (1 to 6)
How would I go about doing this?At the moment all I know about random numbers etc. is that I will need to do something along the lines of Dim dice As New Random or something like that, but, like I mentioned, I have no idea.I am well aware of the DIC rules that you won't write the code for me/do my "homework(?)" for me, and that's not what I'm asking.
View 2 Replies
Oct 4, 2011
I have this block of code that sets up my sql parameters for a stored proc that does an insert.
Dim sproc As StoredProcedure = New StoredProcedure("UsersInsert2", DataAccessConfiguration)
sproc.AddInput("@ID", SqlDbType.NVarChar, 10, entity.UserId)
sproc.AddInput("@PCode", SqlDbType.SmallInt, entity.PriviledgeCode)
sproc.AddInput("@Pwd", SqlDbType.NVarChar, 10, entity.Password.ToString())
[code]...
I've tested the stored proc in SSMS and it works.The problem is when I try to call it from the application. it fails. the @@rowcount = -1. I've tried returning an error code from the db... no dice. keeps coming back as -1 what is going to get executed looks like this
sproc = {EXEC UsersInsert2 @ID=ruxtest7, @PCode=0, @Pwd=1234, @Lang=E, @Name=ruxpint, @Notice=1, @CreatedBy=ruxpint}
I've re-used this code several times. only difference being I'm using NVarChar and it's vb.net.
View 1 Replies
Jul 26, 2011
I have created a webservice in VB.NET
<WebMethod(Description:="This
method will return object Values (in an array of String)for all objects (in an array og String)",
Enablesession:=False)>
[Code]....
Error 1 Value of type '1-dimensional array of String' cannot be converted to 'TestUse_SEdkVistaWebService.JF_WebService.ArrayOfString'
View 4 Replies
Dec 20, 2010
I'm working on a program that will randomly select a loadout(weapon, perks, etc), but the user enters their current level to get the loadout. This is important because certain guns unlock at certain levels, so i don't want someone getting something they can't use.
I'm not sure what the best way of approaching this is. All i can think of is either getting a random item, checking if the user's level is high enough then if it's not high enough do it again.
View 9 Replies
Oct 9, 2009
I need to generate random strings in vb.net, which must consist of (randomly chosen) letters A-Z (must be capitalized) and with random numbers interspersed. It needs to be able to generate them with a set length as well.
View 5 Replies
Feb 15, 2010
I am writing a little app for the kids at a local kindergarden and I have some trouble with my code. I have a RichTextBox containing several times in the text the name John. I want to replace randomly the name John with other women names like below
So I have this:
Public Sub Replacements()
RichTextBox1.Text="John goes to the car and leaves. John it's taking a nap. Since John works late so (s)he won't be home for dinner. John loves the kids and the kids love John and made a really nice picture"
[Code]......
View 10 Replies
Jun 22, 2010
When I use my own word e.g. here "jose" the results are correct but when I use random string it doesnt work the same.
Here's my code
Imports System.Text
Public Class Form2
Dim guess As String = " "
Dim bulls As Integer = 0
Dim cows As Integer = 0
[Code] .....
View 1 Replies
Aug 28, 2010
I need to generate a lot of random 2 character strings for my application. it's a VB console application. basically what I have tried for random strings is this:
Private Function GenerateRandomString(ByVal intLenghtOfString As Integer) As String
'Create a new StrinBuilder that would hold the random string.
Dim randomString As New StringBuilder
[Code]....
What is going on? I thought that I used to, a long time ago, be able to just do random.Next.
View 2 Replies
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
Apr 28, 2007
I'm converting a user generated list box to an array and then generating a user defined number of random strings and placing it in a textbox.The code I have works fine as it will generate the number of random strings the user wants, except sometimes a line is blank at the top of the list but is counted as a string.
View 4 Replies
Oct 22, 2010
I'm trying to create a number of strings based on one long string that i'm passing.
Basically this is an example of my long string
StrMain = AL123456 - PR123456 - RD123456 - LO123456
So in this case I want to create 4 separate strings.
Str1 = AL123456
Str2 = PR123456
Str3 = RD123456
Str4 = LO123456
But there isn't always that many or there may be more so I need to count how many - there are and with that then create the amount strings needed.
View 3 Replies
Jun 3, 2010
I want the program exe file should be used as a dos command with options. ex: dir /p
same way myapp.exe /auto. Iam using visual studio 2008,
View 3 Replies
Oct 16, 2010
I'm trying to execute CREATE USER with a given username (via sql parameter)
exec sp_executesql N'CREATE USER @LoginName
FOR LOGIN @LoginName;',
N'@LoginName varchar(5)', @LoginName='myuser'
Heres the code thats generating the above:
Dim myCommand As SqlCommand = New SqlCommand("CREATE USER @LoginName
FOR LOGIN @LoginName;",
ClassDatabaseConnection.CustomInstance)
[code].....
I get and error:Incorrect syntax near '@LoginName'.I think this is due to the parameters being passed as VarChar causing 'MyUser' rather than MyUser Can I not do this with sql parameters?
View 2 Replies
Apr 26, 2012
we are suposed to create a program that we like with certain peramiters, I have done as much however I have an error and I can not find a solution anywhere. We are, before you ask, able to seek help on this matter. Here is what I have:
[code]...
View 4 Replies
Jun 5, 2012
Is there a way to create a method with unknown number of parameters? And if it this the case: How is it possible to get access to them within this method? Do they have to be from the same type?
View 1 Replies
Feb 22, 2011
I have a 2d array of chars and i need to start at (0,0) and creat a string and check it against some value then still then add another char to the first one and check it. I need to do that in every direction.[code]say im at the H their are like 8 way i need to check..
View 1 Replies
Jun 30, 2010
If I have a list box or something that has a list of like 4 years (like 2006 through 2009), how do I programmatically make variables of these years with names like pTable2006, pTable2007, etc (as ITable of course). If this isn't possible and I have publicly declared these tables in the declarations (like pTable2006 as ITable, pTable2007 as ITable, etc), how can I programmatically assign these variables based on user choice?
What I'm asking is, if the user wants to choose years 2006 and 2007, how can I write this:
pTable & ListBox.Items.Item(0) = [table path string] & ListBox.Items.Item(0)
(please ignore the syntax of the "listbox", I'm just trying to come up with an example)
Whenever I put something like pTable & "string", I get an error.
View 1 Replies
Oct 23, 2011
I'm new in this forum, and I'm a very very very basic user of the VB. How can I create a list of strings? I'm trying to make a chat with a robot. I put 2 labels. And my code is:
Dim mylist As New List(Of String)
mylist = "hello", "bye"
If Not Label1.Text = mylist Then
[code].....
View 2 Replies
Mar 16, 2012
it is possible to create objects from strings.Supose I have a class Matrix with a Row(x) property and an array S = {"One","Two"}. Can i do something like this in vb.net?
For i = 0 To 1Dim S(i) = New MatrixNext i
Dim P As String() = One.Row(0)
'Which gives me the first row of Matrix One How can I create objects similar to this?
View 3 Replies
Jan 21, 2010
I have a question with jagged array, every element can contain strings, be empty or be nothing.
I would like to create a jagged array and put some strings into its cells.
Public Sub S1 ()
Dim MyArr(7)() As String ' OK
MyArr(1) = New String(8) {} ' OK the second cell contains 9 subcells
[Code].....
View 5 Replies
Jun 6, 2011
What would be the easiest way for me to create a list of words with a sequential number appended to the string. I need the string and amount of numbers to be a variable. For example:
network1
network2
network3
network4
[Code].....
View 2 Replies
Jun 11, 2009
I have some really sloppy code that creates an XML file with a random name. The random name (SessionID) is passed into the Sub, but the sub checks IF File.Exists first. If it does exist, it creates a new randoms file name based on System.Random (has to be done this way because it is also a SessionID).
View 4 Replies
Dec 10, 2011
i have errors while creating
View 13 Replies
Apr 17, 2009
I'm working on my graduation project and within it i need a function gives me random ID numbers and random dates since 2008,01,01 untill now .. I'm done with the ID numbers but i couldnt find a solution for the dates
View 5 Replies
Oct 22, 2010
how to create random characters in vb8
View 10 Replies
Mar 26, 2010
eexcuse me can you help me again? i need to do a crossword search puzzle? do you have any idea how the interface should look like? interface for the puzzle? i can already generate the words but how do i make it link with the puzzle. anyway i think the first step is to creat the puzzle first right? what should i use to create the random alphabets? and how do i add the alphabets?
View 5 Replies
Apr 17, 2012
I'm working on something relatively simple I am trying to create a dynamic amount of comma separated strings.I have a variable (numberOfStrings) which is the number of different strings I need.I just want to loop thru the aryDrivers and assign then to the different strings.Dim aryHeats(numberOfStrings - 1) As ArrayList
Dim aryDrivers() As String
aryDrivers = txtBatch.Text.Split(",")
For i As Integer = 0 To aryDrivers.Length - 1
For j As Integer = 0 To aryHeats.Length - 1
aryHeats(j).Add(aryDrivers(i) & ",")
Next
[Code]...
View 2 Replies
Jun 3, 2012
I'm attempting to create a small app that allows a teacher to input 5 students with 5 test scores each. I need to create arrays of strings to hold the five students names, an array of five strings to hold each student�s letter grade, and five arrays of five single precision numbers to hold each students set of test scores.
[Code]...
View 3 Replies
Apr 19, 2011
I have not messed with VB much and I have been trying to do something that has me stumped. I wanted to create an array of 10 random numbers. Each of these numbers then is printed onto a label. From here I have two more labels that show the highest and lowest value. I got the first part, 10 random numbers show up but then things get shaky. This is what I have thus far.
[Code]...
View 1 Replies