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 8068893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:50:01+00:00 2026-06-05T12:50:01+00:00

I have a drop down list on one form that populates a puzzle id

  • 0

I have a drop down list on one form that populates a puzzle id code from a sql table.
when the user selects a puzzle code say “puzzle2” i want the next form(play:Form) to display this puzzle. At the moment i can only get it to display the 1st puzzle “puzzle1” on the page.

The database consists of puzzleID which is the puzzle type and puzzle which is the puzzle question itself.

public partial class Play : Form

{

    public Play()
    {
        InitializeComponent();


        SqlConnection conn = new SqlConnection("Data Source=LAURA-PC;Initial Catalog=Sudoku;Integrated Security=True");
        conn.Open();

        SqlCommand command = conn.CreateCommand();
        command.CommandText = "Select puzzle from Puzzle";
        command.CommandType = CommandType.Text;


        SqlDataReader reader = command.ExecuteReader();
        if (reader.Read())
        {
            string[] tokens = ((string)reader[0]).Split(';');

            textBox1.Text = tokens[0];
            textBox2.Text = tokens[1];
            textBox3.Text = tokens[2];
            textBox4.Text = tokens[3];
            textBox5.Text = tokens[4];
            textBox6.Text = tokens[5];
            textBox7.Text = tokens[6];
            textBox8.Text = tokens[7];
            textBox9.Text = tokens[8];
            textBox10.Text = tokens[9];
            textBox11.Text = tokens[10];
            textBox12.Text = tokens[11];
            textBox13.Text = tokens[12];
            textBox14.Text = tokens[13];
            textBox15.Text = tokens[14];
            textBox16.Text = tokens[15];
        }
        conn.Close();

    }

I know i need to implement some sort of of global variable from the drop down list in the previous form and then try filter that variable into Where statement? But im having no luck.

Thanks

  • 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-05T12:50:03+00:00Added an answer on June 5, 2026 at 12:50 pm

    You can make an static class as a common place to share objects. All classes can see this class and use its members.

    public static class CommonClass
    {
       public static String puzzleCode ;
    }
    

    Also you can have a property on the second form to accept the puzzle id. Like this :

    public class SecondForm : Form
    {
       private String _puzzleId ;
    
       public String PuzzleId
       {
          get { return _puzzleId ; }
          set { _puzzleId = value ; }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drop down list that is populated with data in the code
I have a form that has a drop down list of song titles. I
I have a drop down list on a form with values: Value One Value
I have this application that has a form with a drop-down list and a
I have two separate fields with a drop-down list, one is for User and
I have one drop down list in my page, which contains two options. What
I have a drop-down list which is generated based on the following sql query:
I have a drop down list that has options that need to be passed
I have a drop down list that triggers an updatepanel when the index is
I have a drop-down list hardcoded in an MVC View User Control page 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.