473,779 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forms and Label

I wonder if you could help.

The event handler code below, will allow the user to change the phone number
and write it on a label of a message box. I want to replace the message box
with a dialog box.

Can anybody help me replace the message box below to a dialog box. In other
words. I want to write the new phone number on a label (named "labe1")of a
dialog box (named "dialog2),inste ad of writing the new phone number on the
label of a message box.

private: System::Void dialogBtnItem_C lick(System::Ob ject * sender,
System::EventAr gs * e)

{

// Create the dialog

MyDialog* box = new MyDialog();
//Fill in the initial data

box->Phone = S"(650)123-3456)"; // <------ This is the phone number to be
changed

//Show dialog

if (box->ShowDialog() == DialogResult::O K)

{

MessageBox::Sho w(box->Phone); //<-----I tried to change this line
}

}
Apr 23 '07 #1
8 1610
You will need a dialog with a label whose ID is different than IDC_STATIC,
because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1 label,
try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbox->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoModa l();

Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
I wonder if you could help.

The event handler code below, will allow the user to change the phone number
and write it on a label of a message box. I want to replace the message box
with a dialog box.

Can anybody help me replace the message box below to a dialog box. In other
words. I want to write the new phone number on a label (named "labe1")of a
dialog box (named "dialog2),inste ad of writing the new phone number on the
label of a message box.

private: System::Void dialogBtnItem_C lick(System::Ob ject * sender,
System::EventAr gs * e)

{

// Create the dialog

MyDialog* box = new MyDialog();
//Fill in the initial data

box->Phone = S"(650)123-3456)"; // <------ This is the phone number to be
changed

//Show dialog

if (box->ShowDialog() == DialogResult::O K)

{

MessageBox::Sho w(box->Phone); //<-----I tried to change this line
}

}
Apr 25 '07 #2
Hi Luis,

I thank you a lot for trying to help, but you may be so fluent in the
language, that I can not catch up with you or you are speaking different
language. Make it easy for me please.

"Luis Antonio Rosello Garcia" <la*@pulsoinfor matica.eswrote in message
news:EB******** *************** ***********@mic rosoft.com...
You will need a dialog with a label whose ID is different than IDC_STATIC,
because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label,
try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbox->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoModa l();

Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
>I wonder if you could help.

The event handler code below, will allow the user to change the phone
number
and write it on a label of a message box. I want to replace the message
box
with a dialog box.

Can anybody help me replace the message box below to a dialog box. In
other
words. I want to write the new phone number on a label (named "labe1")of
a
dialog box (named "dialog2),inste ad of writing the new phone number on
the
label of a message box.

private: System::Void dialogBtnItem_C lick(System::Ob ject * sender,
System::EventA rgs * e)

{

// Create the dialog

MyDialog* box = new MyDialog();
//Fill in the initial data

box->Phone = S"(650)123-3456)"; // <------ This is the phone number to be
changed

//Show dialog

if (box->ShowDialog() == DialogResult::O K)

{

MessageBox::Sh ow(box->Phone); //<-----I tried to change this line
}

}

Apr 26 '07 #3
Hi Allen,
I'm sorry because you didn't understood me, certanly my english is a little
poor and the Google translator is not as good as I want.
What I want to say is that you need to make a new dialog from the
ResourceView. That dialog must have an Static Text resource. When you place
it, then Visual C++ asigns a default id: IDC_STATIC. You can't use this
default id in order to get the CWnd object associated to it.
Also you must create a new class associated to the dialog resource. I
usually double click on the Ok button, and Visual C++ ask me if I want that
Visual C++ environment create that class automatically, and I answer yes.
In the example I proposed to you, you must change the id of the static text
from IDC_STATIC to IDC_STATIC1, and you must create a class CMyMsgBox
associated to the dialog.
On your main program, or the function you use to show the new dialog, you
must add the lines I wrote.
CMyMsgBox mymsgbox; // this line defines a variable mymsgbox and calls the
dialog class constructor for that new variable
CWnd *plabel; // this variable is needed in order to get the CWnd pointer
associated to the static text in the new dialog
plabel=mymsgbox->GetDlgItem(IDC _STATIC1); // getting the CWnd pointer to the
label
plabel->SetWindowText( box->Phone); // setting the text you want to the label
mymsgbox.DoModa l(); // showing the dialog
I hope that this explanation will be enough for you.
Good luck and regards,
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
Hi Luis,

I thank you a lot for trying to help, but you may be so fluent in the
language, that I can not catch up with you or you are speaking different
language. Make it easy for me please.

"Luis Antonio Rosello Garcia" <la*@pulsoinfor matica.eswrote in message
news:EB******** *************** ***********@mic rosoft.com...
You will need a dialog with a label whose ID is different than IDC_STATIC,
because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label,
try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbox->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoModa l();

Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
I wonder if you could help.

The event handler code below, will allow the user to change the phone
number
and write it on a label of a message box. I want to replace the message
box
with a dialog box.

Can anybody help me replace the message box below to a dialog box. In
other
words. I want to write the new phone number on a label (named "labe1")of
a
dialog box (named "dialog2),inste ad of writing the new phone number on
the
label of a message box.

private: System::Void dialogBtnItem_C lick(System::Ob ject * sender,
System::EventAr gs * e)

{

// Create the dialog

MyDialog* box = new MyDialog();
//Fill in the initial data

box->Phone = S"(650)123-3456)"; // <------ This is the phone number to be
changed

//Show dialog

if (box->ShowDialog() == DialogResult::O K)

{

MessageBox::Sho w(box->Phone); //<-----I tried to change this line
}

}


Apr 26 '07 #4
Luis Antonio Rosello Garcia wrote:
You will need a dialog with a label whose ID is different than IDC_STATIC,
because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1 label,
try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbox->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoModa l();
Luis: Isn't the OP using Managed C++?

Allen: If you want to use .NET framework I would strongly advise
updating to VS2005 (or VS2007 hopefully out this later year), because
the syntax for managed code is completely different/much improved.

--
David Wilkinson
Visual C++ MVP
Apr 26 '07 #5
Hi Luis,

I hope you knew that when I referred to language I was not referring to
English. I was referring to- the programming language- Visual C++ .NET
2003. The reason I said that, is because you might be using different
language such as Visual basic. If you were using the same programming
language, you may be so fluent that I could not catch up with you. I will
try to understand what you wrote and thank you very much for all of your
helps


"Allen Maki" <al*******@sbcg lobal.netwrote in message
news:Ea******** *******@newssvr 23.news.prodigy .net...
Hi Luis,

I thank you a lot for trying to help, but you may be so fluent in the
language, that I can not catch up with you or you are speaking different
language. Make it easy for me please.

"Luis Antonio Rosello Garcia" <la*@pulsoinfor matica.eswrote in message
news:EB******** *************** ***********@mic rosoft.com...
>You will need a dialog with a label whose ID is different than
IDC_STATIC,
because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label,
try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbo x->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoMod al();

Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@pul soinformatica.e s

"Allen Maki" wrote:
>>I wonder if you could help.

The event handler code below, will allow the user to change the phone
number
and write it on a label of a message box. I want to replace the message
box
with a dialog box.

Can anybody help me replace the message box below to a dialog box. In
other
words. I want to write the new phone number on a label (named "labe1")of
a
dialog box (named "dialog2),inste ad of writing the new phone number on
the
label of a message box.

private: System::Void dialogBtnItem_C lick(System::Ob ject * sender,
System::Event Args * e)

{

// Create the dialog

MyDialog* box = new MyDialog();
//Fill in the initial data

box->Phone = S"(650)123-3456)"; // <------ This is the phone number to
be
changed

//Show dialog

if (box->ShowDialog() == DialogResult::O K)

{

MessageBox::S how(box->Phone); //<-----I tried to change this line
}

}


Apr 27 '07 #6
Hi David,

I am working, now, with Visual C++ .NET 2003. I have MS visual C++ 2005.
Thanks .

Allen.
"David Wilkinson" <no******@effis ols.comwrote in message
news:ee******** ******@TK2MSFTN GP06.phx.gbl...
Luis Antonio Rosello Garcia wrote:
>You will need a dialog with a label whose ID is different than
IDC_STATIC, because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label, try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbo x->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoMod al();

Luis: Isn't the OP using Managed C++?

Allen: If you want to use .NET framework I would strongly advise updating
to VS2005 (or VS2007 hopefully out this later year), because the syntax
for managed code is completely different/much improved.

--
David Wilkinson
Visual C++ MVP

Apr 27 '07 #7
Hi Allen,
The code I wrote was in Visual C++ 6.0. I don't use Visual C++ .NET because
I write Pro*C programs in order to connect to Oracle 8i databases, and there
is no Visual C++ .NET libraries for Oracle 8i Pro*C.
I thought that the only difference between .NET and 6.0 was the namespaces.
The C++ language is the same, and also you have a lot of advantages in the
Visual Studio 2003 .NET environment.
In response to David Wilkinson comments, I'll tell that of course Visual
Studio 2005 .NET is better than 2003, 2005 is the best because is the last
version and has still more advantages than 2003, but this is another theme.
Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
Hi David,

I am working, now, with Visual C++ .NET 2003. I have MS visual C++ 2005.
Thanks .

Allen.
"David Wilkinson" <no******@effis ols.comwrote in message
news:ee******** ******@TK2MSFTN GP06.phx.gbl...
Luis Antonio Rosello Garcia wrote:
You will need a dialog with a label whose ID is different than
IDC_STATIC, because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label, try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbox->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoModa l();
Luis: Isn't the OP using Managed C++?

Allen: If you want to use .NET framework I would strongly advise updating
to VS2005 (or VS2007 hopefully out this later year), because the syntax
for managed code is completely different/much improved.

--
David Wilkinson
Visual C++ MVP


May 2 '07 #8

"Luis Antonio Rosello Garcia" <la*@pulsoinfor matica.eswrote in message
news:A6******** *************** ***********@mic rosoft.com...
Hi Allen,
The code I wrote was in Visual C++ 6.0. I don't use Visual C++ .NET
because
I write Pro*C programs in order to connect to Oracle 8i databases, and
there
is no Visual C++ .NET libraries for Oracle 8i Pro*C.
I thought that the only difference between .NET and 6.0 was the
namespaces.
The C++ language is the same, and also you have a lot of advantages in the
Visual Studio 2003 .NET environment.
In response to David Wilkinson comments, I'll tell that of course Visual
Studio 2005 .NET is better than 2003, 2005 is the best because is the last
version and has still more advantages than 2003, but this is another
theme.
If you haven't used .NET, you can't begin to imagine the ways in which
2005's C++/CLI language beats the abortive attempt that was 2003's Managed
Extensions for C++.

If you're talking only native code, then there are just a few new features
from 2002 -2003 -2005 (although all are much better than 6.0 as far as
support for ISO C++). But the .NET side took a huge leap forward with 2005.
Regards
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Allen Maki" wrote:
>Hi David,

I am working, now, with Visual C++ .NET 2003. I have MS visual C++
2005.
Thanks .

Allen.
"David Wilkinson" <no******@effis ols.comwrote in message
news:ee******* *******@TK2MSFT NGP06.phx.gbl.. .
Luis Antonio Rosello Garcia wrote:
You will need a dialog with a label whose ID is different than
IDC_STATIC, because this ID is generic.

Suposing you have something like a CMyMsgBox class with a IDC_STATIC1
label, try this:

CMyMsgBox mymsgbox;
CWnd *plabel;

plabel=mymsgbo x->GetDlgItem(IDC _STATIC1);
plabel->SetWindowText( box->Phone);
mymsgbox.DoMod al();

Luis: Isn't the OP using Managed C++?

Allen: If you want to use .NET framework I would strongly advise
updating
to VS2005 (or VS2007 hopefully out this later year), because the syntax
for managed code is completely different/much improved.

--
David Wilkinson
Visual C++ MVP



Jun 6 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
5686
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
0
2314
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the example source code can be downloaded here: http://www.blogitek.com/timhaughton/archives/files/User%20Interrogator%20And%20TDD.zip The article text is below. Not sure what it will do to the formatting when
3
2289
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of master form. Method 2 opens the form but when I right click on the Notify Icon I don't get the context menu that I should be seeing. I can interact with the main form window but I cannot interact with the NotifyIcon. Method 2 gives a object reference...
3
4871
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be protected by forms authentication. When I create forms authentication at root level it works but when I move my code up to the subfolder I get this error: Server Error in '/TestProjects/FormsAuthenticationTestingArea' Application.
1
1383
by: Sunil Sabir | last post by:
Dear All, I have 4 web ASP.net Forms. I use a image control to move between these forms.The problem I am facing is that I cannot preserve the state of the form when moving between different forms. For example, on my first form I have a question, a text box and a button. The user sees the question and then writes answer in the text box and then presses submit button.as soon as he
7
2479
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls each with a couple of controls in them I then rebuilt my project and my new panels and all controls they contained are gone... I've looked through the Auto generated code but don't see anything that looks wrong Any body have any idea why this...
15
2065
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for multiple users? opens multiple instances of password form instead of one: Public Class Splash Inherits System.Windows.Forms.Form
3
2375
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes get MyVarialble is not declared errors when the variable is quite clearly declared, when I change it to public and then back again to private the error goes away!!! Also I get lots of member not found errors, these however don't stop me from...
1
2118
by: Dawoodmm | last post by:
Hi i have a sight problem with detecting the mouse up in a drag-drop outside a form what i have on my hands is an mdi form with 2 child forms: form1 and form2, both containing a label each. i also have a separate class (global vars) contining static members to pass data between forms.: MDI parent: . form1 . form2 . globalvars form1:
0
1246
by: Sergio E. | last post by:
Hello, I have a problem with masterpages and forms security. I made a new Web site, in which I have my page login.aspx as the homepage , a master page with only a sitemappath object in it, the file of map of the site, the web.config and another page to do tests. In the page redirected from login there are a label and a combo (dropdown)
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.