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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:33:51+00:00 2026-05-22T23:33:51+00:00

I’m creating a preferences form in VC++ MFC, and I have several textfields that

  • 0

I’m creating a preferences form in VC++ MFC, and I have several textfields that only accept integers. I’m new to MFC, so this is how I found to initialize them in some tutorial:

CProgramDlg::CProgramDlg(CWnd* pParent /*=NULL*/)
: CDialog(CProgramDlg::IDD, pParent)
, m_nSampleValue1()
, m_nSampleValue2() ... m_nSampleValueN {}

This is grand and all, but when I run it, all of the textboxes are filled with zeros. I know with strings that you can just send it “” and it will clear the textbox, but I tried NULL for my ints and did not have any luck.

Is there a trick to getting the textboxes to just be empty without showing zeros? Thank you for your help!

  • 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-05-22T23:33:52+00:00Added an answer on May 22, 2026 at 11:33 pm

    m_nSampleValue1() and m_nSampleValue2() are value-initialized. If its primitive types, then that means they will be zero-initialized.

    Is there a trick to getting the textboxes to just be empty without showing a 0?

    If its integral type, then I think that isn’t possible without changing other part of the code (which part? you’ve not posted it here). If you don’t want to do that, or if that is hard to do, then you can change the type of the members to string, then they will be empty strings automatically.


    However, if you want to see non-zero values, then do this:

    CProgramDlg::CProgramDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CProgramDlg::IDD, pParent)
    , m_nSampleValue1(100)
    , m_nSampleValue2(200) ... m_nSampleValueN(1000) {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites 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.