GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jul-2005, 00:07
patti_ patti_ is offline
New Member
 
Join Date: Jul 2005
Posts: 5
patti_ is on a distinguished road

MFC Assertion Failed


Hi, I new with MFC, I am trying to create a small application for PDA.
I have now created a ComboBox Control and when I try .AddString() I'll get Assertion Failed.
Why is that?

Thanks In advance
Patrik
  #2  
Old 21-Jul-2005, 00:30
Xirtam
 
Posts: n/a
Quote:
Originally Posted by patti_
Hi, I new with MFC, I am trying to create a small application for PDA.
I have now created a ComboBox Control and when I try .AddString() I'll get Assertion Failed.
Why is that?

Thanks In advance
Patrik

Hi,
You have this message because your COMBO Control is not Yet created. the variable that reference it = undifined value.

i think you have added this code (combo.AddString("")) in the OnCreate() handler.

if your combo is on top of a dialog box, try adding the AddString() in the OnInitDilaog() just before the "return TRUE".

wish this help u.

Xirtam.
  #3  
Old 21-Jul-2005, 00:41
patti_ patti_ is offline
New Member
 
Join Date: Jul 2005
Posts: 5
patti_ is on a distinguished road
Quote:
Originally Posted by Xirtam
Hi,
You have this message because your COMBO Control is not Yet created. the variable that reference it = undifined value.

i think you have added this code (combo.AddString("")) in the OnCreate() handler.

if your combo is on top of a dialog box, try adding the AddString() in the OnInitDilaog() just before the "return TRUE".

wish this help u.

Xirtam.


YES, Thanks alot! I don't understand exacly how it is like this, but now it works.

Best Regards Patrik
  #4  
Old 21-Jul-2005, 00:50
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,031
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by patti_
Hi, I new with MFC, I am trying to create a small application for PDA.
I have now created a ComboBox Control and when I try .AddString() I'll get Assertion Failed.
Why is that?

Thanks In advance
Patrik

Well, did you create the combo via the Graphical Interface, or did you add it manually, by code? In case you went for the second, you need to both create the control and add it to the dialog (or whatever):

CPP / C++ / C Code:
	m_fileExtension = new CComboBox();
	m_fileExtension->Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT,
			CRect(709, 122, 759, 202), this, 10034);

	m_fileExtension->AddString(".txt");
	int nRetCode = m_fileExtension->AddString(".doc");
	nRetCode = m_fileExtension->AddString(".xls");

This is an example from a lame program of mine. Modify the values from CRect - or better yet find a formula to position the combo relative to your dialog box - so they better suit your needs.

In case this wasn't the problem, please let me know. If that is the case, please provide a short and relevant piece of code showing the way you handle the combo.

Kind regards,
Lucian

[edit]
it seems I replied too late...
[/edit]
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
assertion error FooFighter MS Visual C++ / MFC Forum 1 17-May-2005 15:03
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 07:10
Non-local heaps and assertion errors Marius MS Visual C++ / MFC Forum 1 03-Sep-2004 05:45
Assertion Error spudtheimpaler C Programming Language 6 20-Feb-2004 09:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 12:32.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.