Solved

Changing textbox

Posted on 2006-06-22
5
271 Views
Last Modified: 2010-04-16
I have some code that was written for me that I want to modify. It is for me Horseshoe Scoring PPC Program.
When I start a NEW GAME, I want it to ask me for the Hanidcap of Pitcher1 and Handicap of Pitcher2.

Here is what I have:
      private void button10_Click(object sender, EventArgs e)
        {
            DialogResult dlgRes;
            dlgRes = MessageBox.Show("New game?", "Confirm New Game", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
            if (dlgRes != DialogResult.Yes)
            {
                return;
            }
           
           
            ringer = false;
            ringercount = 0;
            points = 0;
            updatepoints = true;
            ringerpointspair = false;
            //score:
            this.label16.Text = "0";
            this.label17.Text = "0";
            //ringers:
            this.label33.Text = "0";
            this.label35.Text = "0";
            //shoes:
            this.label44.Text = "0";
            //avg:
            this.label21.Text = "0.0";
            this.label22.Text = "0.0";
            this.labelringerspoints.Text = "Ringers: \nPoints: ";

            prevscore1 = "0";
            prevscore2 = "0";
            prevringers1 = "0";
            prevringers2 = "0";
            prevshoes = "0";
            prevringer_avg1 = "0.0";
            prevringer_avg2 = "0.0";

        } // end button10_click

So instead of Assuming I have 0 Points for label16.text and label17.text, I want my program to ask me what the Hanidcap is for each player.
Thanks for any help to an absolute NOVICE,
David
0
Comment
Question by:claverd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 16959823
use the inputBox:

System.String InputBox(System.String Prompt, System.String Title = "", System.String DefaultResponse = "", System.Int32 XPos = -1, System.Int32 YPos = -1)
    Member of Microsoft.VisualBasic.Interaction

the function returns the string the user enters into the inputbox for examepl

string blah = InputBox("Enter something");
0
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 16959975
if you cannot use InputBox()you will need to create a Dialog window yourself, which contains a textbox and the OK button, it is very simple!!
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 500 total points
ID: 16960190
Form s=new Form();
                  Label l=new Label();
                  l.Name="lblValue";
                  l.Text="Enter the value";
                  l.Top=5;
                  l.Left=10;
                  l.Width=80;
                  TextBox k=new TextBox();
                  k.Top=5;
                  k.Left=100;
                  k.Width=80;
                  k.Name="txtValue";
                  s.Owner=this;
                  s.Controls.Add(l);
                  s.Controls.Add(k);
                  s.ShowDialog();
                  string s1=k.Text;
                  MessageBox.Show(s1);
0
 

Author Comment

by:claverd
ID: 16960574
Pradeepsudharsan,

Thanks for the help! Now I just need one more tweak. How about an OK button on the first Form? and then have it go to picther2.

Thanks,
David
0
 

Author Comment

by:claverd
ID: 16961197
How do you make the FORM not so big?


 I am using this on a POCKETPC and the form is so big the keyboard is not usable?

Thanks,
David
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question