Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8898759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:41:33+00:00 2026-06-15T00:41:33+00:00

How can I implement shuffling of text on my button, i.e. text = chr(n+48)

  • 0

How can I implement shuffling of text on my button, i.e. text = chr(n+48) to shuffle text on each button.

Dim n As Integer = 0

For i As Integer = 0 To 10
    ' Initialize one variable
    btnArray(i) = New Button

Next i

While n < 10
    With btnArray(n)
        .Tag = n + 1 ' Tag of button
        .Width = 40 ' Width of button
        .Height = 40
        .Text = Chr(n + 48)
        FlowLayoutPanel1.Controls.Add(btnArray(n))
        AddHandler .Click, AddressOf Me.GenericClickHandler
        n = n + 1
    End With
End While
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:41:34+00:00Added an answer on June 15, 2026 at 12:41 am

    I don’t know if there is a reason why you are doing that to two steps.
    Try something like this:

    Private btnArray As New List(Of Button)
    
    For i As Integer = 0 To 10
        Dim btn As New Button
        With btn
           .Tag = i ' Tag of button
           .Width = 40 ' Width of button
           .Height = 40
           .Text = Chr(i + 48)
    
        End With  
        btnArray.Insert(i, btn)
    
       'FlowLayoutPanel1.Controls.Add(btnArray(i))  'It works also
        FlowLayoutPanel1.Controls.Add(btn)
        AddHandler .Click, AddressOf Me.GenericClickHandler
    
    Next i
    

    Based on your comments:

    Private btnArray As New List(Of Button)
    Private btnShuffleArray As New List(Of Button)
    
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        For i As Integer = 0 To 10
            ' Initialize one variable
            Dim btn As New Button
            With btn
                .Tag = i ' Tag of button
                .Width = 40 ' Width of button
                .Height = 40
                .Text = Chr(i + 48)
                btnArray.Insert(i, btn)
                '   FlowLayoutPanel1.Controls.Add(btnArray(i))
                'AddHandler .Click, AddressOf Me.GenericClickHandler
            End With
        Next i
    
        'Randomize the list
        Dim rand As New Random
        Dim index As Integer
        While btnArray.Count > 0
            index = rand.Next(0, btnArray.Count)
            btnShuffleArray.Add(btnArray(index))
            btnArray.RemoveAt(index)
        End While
    
        For i = 0 To 10
            FlowLayoutPanel1.Controls.Add(btnShuffleArray(i))
        Next
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into Windows Azure now and wondering if one can implement a TCP/IP
How I can implement a warning in a text field like this in android:
official android dev website says that:「You can implement your tab content in one of
In C#, I can implement a generic interface twice on one class, using two
How can implement an intent for sharing some text in a dialog like this
Does anyone know how I can implement a single Touch Event. A simple, one
There are 2 ways in which we can implement a fluid design (one that
As noticed in this question: Randomize a List<T> you can implement a shuffle method
I can implement both variants - it's easy. But I'm interested: what approach is
How can implement reordring in winforms datagridview by using the feature of drag and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.