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

  • SEARCH
  • Home
  • 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 8730647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:04:01+00:00 2026-06-13T09:04:01+00:00

Im just learning C# at uni and seem to be struggling to get this

  • 0

Im just learning C# at uni and seem to be struggling to get this random number to out put in a textbox. I havnt learnt a language before this so apologies if its a simple question.

I want to create 5 random numbers, between two different numbers specified by the user. Then print the 5 numbers generated into a textbox to display them.

private void button1_Click(object sender, EventArgs e)
{

        int firstnum = Int32.Parse(txtboxnum.Text);
        int secondnum = Int32.Parse(txtboxnum2.Text);


        Random random = new Random();
        int randomNumber = random.Next(firstnum, secondnum);

        Int32 loop = 0;
        do
        {
            loop++;
        }
        while (loop > 5);

        string myString = randomNumber.ToString();

       string  txtboxanswer = myString;

I would be much appreciative of any suggestions where im going wrong. As i just cant seem to get the answer to appear in my textbox. I know i must be close. I hope 🙂

Thanks for all help in advance.

  • 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-13T09:04:02+00:00Added an answer on June 13, 2026 at 9:04 am

    Simply, you did not set the Text property of the TextBox to the result.

    txtBoxName.Text= myString
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just learning the world of jquery, and all my googling gives examples like this:
Im just learning SQLite and I can't get my parameters to compile into the
I'm just learning MVC3 now and this is really confusing me. I have a
I am just learning python and Qt these days. So please consider that this
Im just learning open cart, but I think this question could be answered by
I'm just learning MVC4, so this is a very basic question. I have a
I'm just learning Java for fun and found this forum very usefull some of
Just started re-learning Haskell (did it at uni but forgot most of it) and
Im just learning javascript and I'm just wondering why this doesn't work. I've created
I'm just learning java out of a what seems to be an excellent book,

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.