Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Passing Text from one form to another...Problem!

elway23elway23 Member Posts: 57
Ok, I'm very new to C# and have only been programming C++ for about 6 months. I've never programmed in VB or Java so making a Window's Application is pretty foreign to me. Here's my problem.

I am writing a blackjack game using C#. I've got a few forms set up, and they all seem to be working correctly with what I have so far. I'm just getting started with it, so the actual "game logic" isn't implemented yet.

The first form that pops up is a simple "Enter your name" form with a text field and an OK button. The object of this form is to take the string name the user enters, store it in a variable, then, when the user clicks OK, the main game comes up and the user's name is supposed to show in the Text porperty of the user's hand. The hand itself, is all within a group_box at the bottom half of the form...but right now, the default text for the group_box is there.

Basically, how do I go about taking the input from the Enter your name form and insert it into the text property of the group_box? I've tried a few different ways with no success.

Can anyone help me out or point me in the right direction? Thanks!

Comments

  • dannysmurfdannysmurf Member Posts: 21
    In your main form:

    EnterNameForm newForm = new EnterNameForm();
    DialogResult dlgResult = newForm.ShowDialog();
    nameLabel.Text = newForm.NameEditCtrl.Text;

  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _____ < http://forcoder.org /> free ebooks and video tutorials about { JavaScript Scratch Ruby Assembly PHP Python Visual Basic C MATLAB Perl Delphi C++ Visual Basic .NET Java PL/SQL R Go Objective-C Swift C# LabVIEW ML Ada ABAP Lisp Hack Crystal Lua F# Erlang Julia Prolog Fortran Scala Bash Rust COBOL VBScript Dart Kotlin SAS Logo Apex Transact-SQL Scheme Clojure FoxPro Alice Awk D } ________

Sign In or Register to comment.