Is there any way to get unique numbers for a label?

Im writing a lottery code and would like to know if there is anyway to get my 6 numbers in my label to be different
this is my code so far
Public Class frmMain
Private randGen As New Random
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnSelect_Click(sender As Object, e As EventArgs) Handles btnSelect.Click
Dim intNum1 As Integer
Dim intNum2 As Integer
Dim intNum3 As Integer
Dim intNum4 As Integer
Dim intNum5 As Integer
Dim intNum6 As Integer
intNum1 = randGen.Next(1, 54)
intNum2 = randGen.Next(1, 54)
intNum3 = randGen.Next(1, 54)
intNum4 = randGen.Next(1, 54)
intNum5 = randGen.Next(1, 54)
intNum6 = randGen.Next(1, 54)
lblNumbers.Text = String.Format("{0}, {1}, {2}, {3}, {4}, {5}", intNum1, intNum2, intNum3, intNum4, intNum5, intNum6)
End Sub
End Class

Here's one way using nested For loops.  This was tested and it works.  It will select 6 different unique numbers between 1 - 54. 
Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
Dim num As Integer, dup As Boolean = False
Dim randnum As New Random()
Dim strand As String = ""
Dim itm As String = ""
For x As Integer = 1 To 6
For y As Integer = 1 To 6
num = randnum.Next(1, 55)
itm = num.ToString()
If strand.Contains(itm) Then
dup = True
x = x - 1
Exit For
End If
Next y
If dup = False Then strand &= itm & " "
dup = False
Next x
lblRandom.Text = strand
End Sub
Here is another way using the Shuffle Sort algorithm with an array:
Private Sub btnShuffle_Click(sender As System.Object, e As System.EventArgs) Handles btnShuffle.Click
Dim mix, temp As Integer
Dim randnum As New Random
Dim strand(54) As Integer
lblRandom.Text = ""
For x As Integer = 1 To 54
strand(x) = x
Next
For x As Integer = 1 To 54
mix = randnum.Next(1, 55)
temp = strand(mix)
strand(mix) = strand(x)
strand(x) = temp
Next
For x As Integer = 1 To 6
lblRandom.Text &= strand(x).ToString & " "
Next
End Sub
Solitaire

Similar Messages

  • I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    Download CS6 products
    Mylenium

  • HT203077 Is there any way to get other voices for the voice over?  Alex is dull.

    Is there any way to get other American English voices for the voice over--besides Alex?

    Settings > General > Siri > Voice Gender

  • Is there any way to get the file for your site from Creative Cloud?

    I lost the file for my Muse site and was wondering if there was any way to get the file from the server or from somewhere in Creative Cloud.
    Thanks.

    Are you Mac or Windows?

  • Is there any way to have unique setup for each Application in a single CSF

    Hello all,
    I am finding that i need more control with CSF files than just syncronising a generic setting that was made in one application...
    For example, for the same workflow, I need to have different policies in different applications such as:
         "Preserve CMYK" in Photoshop to correctly honor profiles in the images etc,
         "CMYK off" in indesign to properly preserve the Separation for my output style.
    Is there any way that i can make one CSF file that works differently on each application?
    Thanks!

    I'm not a ID power useful. I do own and use it ocassionally but I'm linking all the documents. That said, if I want say ProPhoto RGB to be the preferred RGB working space and I open a doc in sRGB, is that a problem in ID? Converting to ProPhoto in this case is senseless. Just leave the document in sRGB. Upon output, multiple images in differing color spaces should (should) be OK upon conversion to an output color space. Does ID have to have all images in the same color space to print?
    This is probably more evident when looking at a CMYK workflow. Although indesign will let you export PDF's with multiple different embedded profiles, I try to avoid this as it tends to result in issues like illustrator graphics that contain black objects which separate into 4 colour and cause potential registration issues on press etc...
    I am trying to remove all CMYK profiles and then asign an output intent by creating a PDFX file but so far the only way to consistently & reliabaly do it appears to be to set the CMYK policy to off in indesign...
    IMO a print ready PDF should only have one profile which describes the printing propcess that will be used to for the file.
    Andrew Rodney wrote:
    Matt Finlay wrote:
    For example having "ask when opening" for profile mismatch is the only way to control your document policies in indesign, which is essential if you are being supplied documents from outside designers. In photoshop this same function equates to an annoying dialog box that does not tell you anything you can't find out or fix without this option enabled.
    I don't see the differences in the two app's in terms of this setting.
    The function inside photoshop equates to "ask me what to do if i open an image whoes assigned profile is different to my workingspace profile". Inside indesign this option represents a conflict in a documents embedded policies with regard to "CMYK/RGB Policy, Document CMYK/RGB profile and also offers you the oportunity to manage the color of placed content".
    While profiles can be assigned elsewhere, and placed content can be managed elsewhere, from what i understand, the only other way to affect your document's CMYK/RGB Policy is through scripting... Changing this in your colour settings only changes this for newly created documents as these options are inherited by the document from the applications colour settings at the time of the document's creation...

  • Deleted Garageband off my 2007 iMac Intel and no longer have the original reinstallation disk and I don't wan't to buy Garageband again. Is there any way to get it back for free?

    Any help? I wouldn't mind any links to where I can install Garageband for free even if it's not from Apple. (Currently running Mac OS X 10.5.8 and will be updating the software tomorrow on February 13th to Snow Leapord 10.6)

    If you don't want to purchase the latest version, you have to call Apple to get replacement DVDs for the iMac > http://support.apple.com/kb/HE57
    When you receive the discs, just insert the Mac OS X Install Disc 2 and install GarageBand.
    If you have a Time Machine backup, you can use it to restore GarageBand. First, open Finder and select Applications on the sidebar. Then, open Time Machine app and navigate through your backups to restore the application

  • Is there any way to get firmware update for my DVD-RW Drive from Ultra 40?

    Hi, I have Sun Ultra 40 Workstation which comes with Matshita DVD-RAM drive.
    While I do enjoy working on my U40 workstation, its DVD-RAM drive is wll pretty bad.
    It just fails to burn DVD/CD-R/RW media too often.
    Yes, I got it serviced, but it's just the same.
    So my final hope is to get the latest firmware, becuase latest firmware often solves such media compatability issues.
    Mine has D100 firmware and I find other people who has the same drive on different system have D101, D200, D201 firmware.
    So does anyone know how to contact Sun to get the latest firmware for my DVD-RAM drive?
    I did contacted Matshita for this matter and they tell me to contact Sun. But I cannot even find email address for Sun Support or any. sigh...
    Thanks.
    Sang

    Hello Sang,
    I have Sun Ultra 40 Workstation which comes with Matshita DVD-RAM drive.
    Mine has D100 firmware and I find other people who has the same drive on different system have D101, D200, D201 firmware.
    So does anyone know how to contact Sun to get the latest firmware for my DVD-RAM drive?
    I did contacted Matshita for this matter and they tell me to contact Sun.
    I did review the Full Components List for the Ultra 40. The only DVD drives listed (Part No. 370-7970) are Panasonic UJ-485 and Teac DV-W28SLA-093. Both aren't capable of reading or writing DVD-RAM.
    In some countries Panasonic uses Matshita as brand name.
    I did a search on SunSolve with the keywords DVD firmware.
    Sun supplies only firmware updates for two DVD readers: Toshiba DVD 1401 (fixes: unable to boot from Solaris 8 DVD) and Toshiba SD-C2732 (fixes: returns incorrect data).
    I was unable to update the firmware of the SD-C2732 (Sun part) with the Sun patch. The drive was attached to an Ultra 10 (with an adapter). I ended attaching the drive to a PC and using a DOS boot floppy with the Toshiba flash program and the Sun firmware.
    Regarding you problems with the drive: Have you tried another brand of media. The Ultra 40 is under warranty (GA date was February 14, 2006).
    Use the contact information from your other thread.
    If you search the net for firmware you can locate sites that offers region-code-free firmware for several drives. Usually they provide a flash program (requires creation of a DOS boot floppy). Using these programs/firmware voids your warranty. Maybe you can not revert the firmware upgrade.
    These slimline drives have no jumpers, the installed firmware (of the drive) determines if the drive is master, slave, uses cable-select (CS) or reversed CS.
    Michael

  • Is there any way to get 3D Support for nokia C5-03...

    Nokia C5-03

    If you're talking about a full 3D viewing experience then no, the hardware is not available on your phone. However there are (as suggested) software alternatives which give a 3D effect to your homescreens.
    If I have helped you, please hit the star at the bottom of my posts - it's appreciated!
    Don't forget if your problem is solved to press the "Accept as Solution" button.

  • HT5919 My company will not allow us to download iOS 7 due to software / security issues on our end. The problem is I need to download numbers but it says I need iOS 7. Is there any way to get an earlier update that's doesn't require ios7?

    My company will not allow us to download iOS 7 due to software / security issues on our end. The problem is I need to download numbers but it says I need iOS 7. Is there any way to get an earlier update of numbers that's doesn't require ios7?

    Thank you so much! It's updating now. I'm hoping that once the update is finished that it will sync like normal as well. Of course I'm still a bit confused/concerned about how it refused to update on it's own, but for now that's not a problem. Hopefully from now on there won't be any more problems.

  • Is there any way of getting back from a wrong clicked free trial to add my serial number correctly?

    Hi
    On purchasing a new imac I copied the apps across & on opening CS6 was requested to load serial numbers, through tiredness I added the seria; number from CS5.5 and therefore not recognised for the CS6, then when about to enter again through tiredness I must have clicked free trial and now have the CS6 in that format.
    Is there any way of getting back to that initial box to load the correct numbers & get out of trial as although it works I need it set up correctly?
    Any help appreciated

    Sorry, cant see this visible on menu or drop downs, did run through all menus before posting, could just be tired from 3 weeks straight.
    If this is not an option does that mean I am set up ?

  • Are there any ways to get sequence number other than getting it for each re

    are there any ways to get sequence number other than getting it for each record

    CACHE is the number of values Oracle stores in memory. So the first call to NEXTVAL Oracle grabs x numbers; subsequent calls to NEXTVAL are served from memory until they're all gone and them another bunch is grabbed. The attached sql*plus output demonstrates this behaviour.
    Note that normally unused numbers in the cache are returned to the data dictionary but in exceptional circumstances (DB crash) they may be lost.
    Cheers, APC
    SQL> create sequence seq cache 3
      2  /
    Sequence created.
    SQL> select last_number from user_sequences
      2  where sequence_name = 'SEQ'
      3  /
    LAST_NUMBER
              1
    SQL> select seq.nextval from dual
      2  /
       NEXTVAL
             1
    SQL> select last_number from user_sequences
      2  where sequence_name = 'SEQ'
      3  /
    LAST_NUMBER
              4
    SQL> select seq.nextval from dual
      2  /
       NEXTVAL
             2
    SQL> select last_number from user_sequences
      2  where sequence_name = 'SEQ'
      3  /
    LAST_NUMBER
              4
    SQL> select seq.nextval from dual
      2  /
       NEXTVAL
             3
    SQL> select last_number from user_sequences
      2  where sequence_name = 'SEQ'
      3  /
    LAST_NUMBER
              4
    SQL> select seq.nextval from dual
      2  /
       NEXTVAL
             4
    SQL> select last_number from user_sequences
      2  where sequence_name = 'SEQ'
      3  /
    LAST_NUMBER
              7
    SQL>

  • Is there any way to get the height/width of an image before importing it in the indesign document.

    Hi All,
    I need to obtain an image's attributes such as dimensions (height, width in pixels) without placing image in indesign document.
    I have full path of the image (say abc.jpg is stored at c:\my pic\abc.jpg).
    I have obtained the IDFile for this image, tried getting size using GetFileSize() which correctly return size in bytes.
    Is there any way to get the height/width of image without importing it in the indesign document.
    Please, give me some hints. I have spent quite a lot time digging in CHM. I have searched in FileUtils, IDFile API's but found no method which serves this purpose.
    At this point I am clueless where to search next.
    Any help will be appriciated.
    Just a point to mention, I am able to get image height and width for an image in indesign doc though Its not my requirement.
    Thnx,
    D.

    You might be able to examine the contents of the PlaceGun after calling kImportAndLoadPlaceGunCmdBoss without actually placing the image in a document. Not sure, but would be worth looking at.
    Otherwise you will probably have to write platform specific code, ideally with a generic platform-independant wrapper (see SDKSamples/paneltreeview/PlatformFileSystemIterator).
    For the Mac, look at CGImageGetWidth() etc., not sure what the best option is for windows.
    Perhaps Quicktime could provide you with a platform independant solution.

  • Is there any way to get the appStore link for my application

    Hi everyone , i am developing an app which has a feature of sharing its appstore link with the friends through mail,so that they can see my appplication in appstore and buy it directly on click of a button. For that i need to use the app store link of my application for sending it . is there any way to get that and using it dynamically in my app immediately after releasing it.

    Your best bet would be to create a web page of your own for the app. Design that page so that it uses 'META REFRESH' to redirect the visitor straight to the App Store link.
    That way you can hard-wire your own web page address into your app.
    This has the advantage that it can work well even before you've noticed that your app has arrived on the App Store. Create a real web page, describing the app and telling people to search for it in the App Store by name - then replace it with the auto-redirect page when you've discovered your application's App Store address.

  • HT1386 i am trying to restore a backup og my iphone 4 from itunes on my macbook, it asks me for a password which i do not recall setting up, is there any way of getting this password.

    i am trying to restore a backup og my iphone 4 from itunes on my macbook, it asks me for a password which i do not recall setting up, is there any way of getting this password.

    No there's not.  Otherwise that wouldn't be very secure, would it?

  • I had 41 tabs open in about six groups over the last year and a half and I just close them and exited Firefox. Is there any way to get them back?

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [[/questions/856718]]</blockquote>
    I had 41 tabs open in about six groups over the last year and a half and I just close them and exited Firefox. Is there any way to get them back?
    Also, is there any way to save a group or an open session and then restore it later?

    History menu, if it was destroyed in the last session
    then use "Restore Previous session:" and then restore all windows also from the history menu.
    If done in this session try the restore all windows under the history menu.

Maybe you are looking for