Combobox Help needed - How to clear and populate based on what is being typed into combo's edit?

Hello,
I have been trying to populate a Combobox with a filter set to what is
being typed in the combo's edit control. If I type in "C" it selects the
first 40 "C" then I would like to type in "u" clear the listbox portion
and put in the first 40 "Cu" etc.. I would need to clear only the
combo's edit box but unfortunately ResetContent()also clears the edit box.
It gets the first 40 "C" but then the edit box is cleared.
I have also tried using DeleteString.


void CCustView::OnEditupdateCombo1()
{
 UpdateData();
 if (i>0) {  m_CbCust.ResetContent();  i=0; }
 fil="CUST LIKE '"+m_GetCust+"%'";
 m_pSet->m_strFilter=fil;  m_pSet->Requery();

 if (m_pSet->GetRecordCount()>0)
 {
  while (i<40)
  {
   m_CbCust.AddString(m_pSet->m_CUST);
   m_pSet->MoveNext();
   if (m_pSet->IsEOF()) break;
   i++;
  }
 }
}

Thanks.


0
binstar (33)
6/10/2004 1:19:52 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
565 Views

Similar Articles

[PageSpeed] 34

I would suggest the following...it is the first thing I would try (I can't guarantee it
will work, but I think it will)

Ignore UpdateData
Get the current selection in the edit control
Get the current text of the edit control with GetWindowText
ResetContent
SetWindowText to replace the contents of the edit control
Set the selection back to what it was
repopulate the dropdown
				joe

On Thu, 10 Jun 2004 09:19:52 -0400, "Charles C." <binstar@aei.ca> wrote:

>Hello,
>I have been trying to populate a Combobox with a filter set to what is
>being typed in the combo's edit control. If I type in "C" it selects the
>first 40 "C" then I would like to type in "u" clear the listbox portion
>and put in the first 40 "Cu" etc.. I would need to clear only the
>combo's edit box but unfortunately ResetContent()also clears the edit box.
>It gets the first 40 "C" but then the edit box is cleared.
>I have also tried using DeleteString.
>
>
>void CCustView::OnEditupdateCombo1()
>{
> UpdateData();
> if (i>0) {  m_CbCust.ResetContent();  i=0; }
> fil="CUST LIKE '"+m_GetCust+"%'";
> m_pSet->m_strFilter=fil;  m_pSet->Requery();
>
> if (m_pSet->GetRecordCount()>0)
> {
>  while (i<40)
>  {
>   m_CbCust.AddString(m_pSet->m_CUST);
>   m_pSet->MoveNext();
>   if (m_pSet->IsEOF()) break;
>   i++;
>  }
> }
>}
>
>Thanks.
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
6/10/2004 4:45:33 PM
Hello Joseph,
Thanks for your help.
I've managed to get it done, but not in a way that you would approve of:
..
..
 e++;
 if (i>0)
 {
  GetDlgItemText(IDC_COMBO1,ocust);
  m_CbCust.ResetContent();
  SetDlgItemText(IDC_COMBO1,ocust);
  m_CbCust.SetEditSel(e,e);
  i=0;
  fil="CUST LIKE '"+ocust+"%'";
 }
 else
 {
  fil="CUST LIKE '"+m_GetCust+"%'";
 }
 m_pSet->m_strFilter=fil;
 m_pSet->Requery();
..
..

Thanks.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:7t3hc0hug009kq19rpqv88do9k43sc1gtv@4ax.com...
> I would suggest the following...it is the first thing I would try (I can't
guarantee it
> will work, but I think it will)
>
> Ignore UpdateData
> Get the current selection in the edit control
> Get the current text of the edit control with GetWindowText
> ResetContent
> SetWindowText to replace the contents of the edit control
> Set the selection back to what it was
> repopulate the dropdown
> joe
>
> On Thu, 10 Jun 2004 09:19:52 -0400, "Charles C." <binstar@aei.ca> wrote:
>
> >Hello,
> >I have been trying to populate a Combobox with a filter set to what is
> >being typed in the combo's edit control. If I type in "C" it selects the
> >first 40 "C" then I would like to type in "u" clear the listbox portion
> >and put in the first 40 "Cu" etc.. I would need to clear only the
> >combo's edit box but unfortunately ResetContent()also clears the edit
box.
> >It gets the first 40 "C" but then the edit box is cleared.
> >I have also tried using DeleteString.
> >
> >
> >void CCustView::OnEditupdateCombo1()
> >{
> > UpdateData();
> > if (i>0) {  m_CbCust.ResetContent();  i=0; }
> > fil="CUST LIKE '"+m_GetCust+"%'";
> > m_pSet->m_strFilter=fil;  m_pSet->Requery();
> >
> > if (m_pSet->GetRecordCount()>0)
> > {
> >  while (i<40)
> >  {
> >   m_CbCust.AddString(m_pSet->m_CUST);
> >   m_pSet->MoveNext();
> >   if (m_pSet->IsEOF()) break;
> >   i++;
> >  }
> > }
> >}
> >
> >Thanks.
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


0
binstar (33)
6/10/2004 8:51:37 PM
Reply:

Similar Artilces:

Creating a group of cells. Need Help Please.
Havn't used excel in a while and I need to create a group of cell corresponding to an input of a min and a max. Here are the details. On one sheet I have a box where you enter th min and a box where you enter the max. In another sheet I want column starting at A2 to output (MIN,A2+1000,A3+1000,....MAX) ho would I do this -- Thundersix ----------------------------------------------------------------------- Thundersixx's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3055 View this thread: http://www.excelforum.com/showthread.php?threadid=50207 Name the...

Please help..with a formula. I don't know code.
I have a long list of numbers - values in a file X, and I want to fin and replace those values in a even larger list in a file Z an highlight those values in Z -- Message posted from http://www.ExcelForum.com Hi not really sure what you're trying to achieve. What do you want to replace, etc. You may give an example (plain text - no attachment please) >-----Original Message----- >I have a long list of numbers - values in a file X, and I want to find >and replace those values in a even larger list in a file Z and >highlight those values in Z. > > >--- >Message...

chart label reference based on the column number
In a worksheet with an embedded chart, I have a cell, S4, where I enter the number of the column I want to chart (these numbers are listed as labels in cells A2:R2). I can't figure out how to translate the number in S4 into the corresponding column letter. For example, if S4 contains "3", the chart title should be =$C$2. I think working with absolute references, R1C1, might be easier here, but somehow what I've tried, didn't work (the entire spreadsheet is based on relative addresses (A1). z.entropic in a cell (Z100) put =index(A2:G2,1,S4,1) Change G2 to whatev...

Clearing security settings
I am setting up a new server that will be home to GP version 8. I am migrating from 7.5 to 8. I want to clear out all users, advanced security, and standard security settings and recreate them on the new server. Anybody ever scripted this? I assume I want to truncate tables, but I don't know which ones, other than what is show in techkno Steps to remove Advanced Security (874401). TIA If you run a delete statement on the SY02000 table, it will remove all settings, then you can run a reconcile against security restrictions and user access. "Cindy Lange" wrote: > I...

Can't edit print styles in Outlook 2007
Weekly calendar view to print - Define print Styles - Edit "CANNOT DISPLAY THE DIALOG BOX" I'm using trial version - shouldn't be the case???? thks I'm having the same problem where I cant edit the print syles ... please let me know what ou find out. I think being able adjust the format and print the calendar is important, as I usually print my calendar. EggHeadCafe.com - .NET Developer Portal of Choice http://www.eggheadcafe.com Nate This is an Excel newsgroup. I would suggest posting this to an Outlook one -- HTH Nick Hodge Microsoft MVP - Excel Southampton...

Need a default email account for all users, need help.
I have a tablet PC running WinXP Tablet with Outlook 2003. This tablet will connect to our exchange server via VPN. How can I set it up so that everyone that logs onto their account can access one (the same) email account. The problem is that I dont know at this point all of the users however anyone using the tablet will use one generic email account. So how can I set Outlook to default to this account so that no matter who logs on they will use this account? Thanks! Shane ...

Need help with formula 01-13-10
I am trying to adapt a formula in I2 from another spreadsheet that works well, but won't in mine. I've traced the error, but I would need help to understand the help it gives! My formula is this: =IF(J2="0-Jan-00","To be advised",WORKDAY(J2,1,NWD)). I have a worksheet in the same workbook with a list of non-workdays, and defined the column of dates with the name "NWD". What I expect the formula to do is this: If J2 is Feb. 4, it would give Feb. 5 in cell I2 because Feb. 5 is NOT a non-workday in NWD. But if J2 is Feb. 5, and Feb. 6 and...

DEADLINE... PLEASE HELP! Stacked Bar chart?
I'm not even sure how to ask the question so here's what I have... 2003 2004 2005 Actual/Goal Actual/Goal Actual/Goal Me 1009/1061 591/866 658/897 Comp. A 966/1012 633/811 624/808 Comp. B 699/744 450/593 480/607 Comp. C 957/1005 642/821 665/838 I wanto to show a bar for each competitor, for each year, so there will be 4 bars for each year. Each bar showing Actual performance & Performance Goal...

please help with this query
Ost Ocity Dstate Dcity Carrier Price Rank Diff A B C D X 1200 1 100 A B C D Y 1300 2 100 A B C D Z 1350 3 100 A B C D W 1789 4 100 A1 B1 C1 D1 X1 785 1 A1 B1 C1 D1 Y1 789 2 The rank for every carrier is based on the price . If rank1 carrier is not a pariticular carrier(say if it is not X1 or Y1 or Z1), then i want to calculate the difference be...

Office 2010 Buying Question Assistance Needed
I've been looking through the MS Office 2010 web site to try to determine what my new small company would require, but I can't find the information I need. We for sure would need Office Pro Plus, but other than that I'm not sure. We want to run it on our own server. We will initially have 3-5 people using it and perhaps more later on. Would we need to purchase site licensing? Unfortunately, our programmers are MS haters (I'm not) and I can't get any assistance from them on this, but I have power of the pen. I would appreciate any assistance I can get. Th...

Implicit type conversion
In Access 97, Access would perform implicit conversion of data in a text box to, e.g., a Currency when used in an expression like so: If txt_price > txt_sellprice Then However, in Access 2003 this test doesn't perform as expected unless I explicitly cast the text box value to Currency, like so: If CCur(txt_price) > CCur(txt_sellprice) Then Is there a setting or option somewhere that governs this behavior? Or am I going to have to go through my entire app looking for expressions like this and explicity casting them? "Ron Hinds" <billg@microsoft.com>...

Rule to automatically mark header to download based on contact list?
Is there a way to do this, or an add-in? TIA. Rich On Tue, 26 Apr 2005 04:44:35 -1000, rmc <rmc@nospam.com> wrote: > Is there a way to do this, or an add-in? What version of Outlook are you using? -- -Ben- Ben M. Schorr, MVP Hi Ben: 2003 SP1 Rich "Ben M. Schorr - MVP" <bens@bogusaddress.mvp> wrote in message news:op.spuxh8sf6r4cx1@bms-tablet2.scgab.com... > On Tue, 26 Apr 2005 04:44:35 -1000, rmc <rmc@nospam.com> wrote: > > > Is there a way to do this, or an add-in? > > What version of Outlook are you using? > > > -- >...

Combo
Hi, I am able to create a list of items with a drop down menu. I can select specific item but how do I select all item to get a query output. Your help would be much appreciated. Thanks You can't select multiple items from an Access combo box. To do that would require a listbox with it's MULTI-SELECT property set to SIMPLE or EXTENDED. See more info about list boxes here: http://www.fontstuff.com/access/acctut11.htm -- Bob Larson Access World Forums Super Moderator Utter Access VIP Tutorials at http://www.btabdevelopment.com __________________________________ If my post ...

Hyperlink File Help
I am needing some major help. I have a file with hyperlinks in column F that link to a file on our server. I am needing to test to see if the file exists and if it does, copy the file to a folder in my documents called (CapturedFiles) and if it doesn't format the cell color to red. Can VBA do this and if so how? Any help would be greatly appreciated. Thanks in advance. Fileserver or webserver ? Tim On Nov 23, 7:20=A0am, Aaron <Aa...@discussions.microsoft.com> wrote: > I am needing some major help. =A0I have a file with hyperlinks in column = F that > l...

VLookup #VALUE! error help needed to resolve
The following is the funcation I have: =VLOOKUP(B10,'FA CC Summary Report 1141'!F$9:G$92,2,0) I have all the columns formatted the same; as in the column that the function is using to lookup is text and so is the column for this figure in order to pull back the appropriate answer. I have keyed the data instead of having links. I have replaced the final '0' with TRUE & FALSE then put it back. I have formatted the columns for text and for numbers. But I am getting the #VALUE! error in SOME of the cells NOT all of the cells. I don't know what else to d...

Help please user not showing in 5.5 GAL but is in exchange 2003 GA
Up until today I have been bable to add users fine and their address would appear in both the 5.5 GAL and the exchange 2003 GAL. Is a single site with 2 5.5 servers and 1 exchange 2003 server. When I add a new user now through users and computers and put the mailbox on the new exchange 2003 server the user gets his email addresses and appears in the GAL on the 2003 server but people connected the the old 5.5 servers cannot see it. When I open the 5.5 exchange admin tool again if connected to one of the old 5.5 server I cannot see the person I just created but when connected the the 20...

help with a sub
Hi, can anybody tell me why the following code fails at FormatConditions.Add Private Sub CommandButton1_Click() Dim Sh As Worksheet Dim lngLastRow As Long Set Sh = ActiveWorkbook.ActiveSheet lngLastRow = Sh.Cells(Cells.Rows.Count, "A").End(xlUp).Row Range("A4:E" & lngLastRow).Activate Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=(MOD(ROW(),2)=0" Selection.FormatConditions(1).Interior.ColorIndex = 24 End Sub Thanks -- Traa Dy Liooar Jock You have an extra open paren just before MOD: &qu...

cdrom.sys corrupt in Win7
Yesterday Win7 decided to no longer show my 2 LiteOn DVDRW drives. I've tried to re-install/repair the driver (6.1.7600.16385) and everytime I get the same response = my current driver is good. BUT, then when I check with Device Manager, it shows that the drives are not working. Can anyone help me get a new cdrom.sys installed into the system32/drivers folder? Booting up with the Win7 DVD will work. But I can't find the cdrom.sys on the disk. No other repair options are there to get this fixed. Help would certainly be appreciated. I don't want to have to start all o...

Coupon Tender Type setup?
How can I setup a coupon tender type to discount a purchase 10% off the entire purchase? I found article ID 869896 Creating a Transaction Discount Using a Macro in Store Operations which achieves our objective. No further help is need on this post Thanks. "LarryW" wrote: > How can I setup a coupon tender type to discount a purchase 10% off the > entire purchase? > ...

Serializing array of userdefined types
Hello, I want to have a class that contains only a collection of another class. For example: public __gc class Alignment { public: Alignment(); ... }; // Probably using XmlIncludeAttribute such as this is wrong... [System::Xml::Serialization::XmlIncludeAttribute(__typeof(Alignment))] public __gc class Alignments : public System::Collections::ArrayList { public: Alignments(); ... }; I figured I could use Alignments like this: Alignment* alignment = new Alignment; Alignments* alignments = new Alignments; alignments->Add(alignment); BTW, I am using XmlSerializer and XmlTextWriter....

Need to have more Columns available in advanced view
I know how to add columns in advanced view but i can't add all the columns I'd like to add. I can choose more fields (attributs) as search attributes than as result columns. Is there somewhere a switch to turn a field (attribute) into not only beeing searchable but selectable as a column in advanced search? Example: "Invoice Product": Is there a way to make an advanced search or view which delivers field (attributes) of "Invoice Product" as a result? Marko ...

Drawing static/edit control in different colors
Hi All, This should be a simple question, but it is possible to, control the color of text written to static text or an edit box? I need to do this at during InitDialog and while dialog is 'up' (DoModal). As an aside, can change the color of static text just based on the resource ID? i.e. not creating a variable for the control in the dialog class. Thanks in Advance! Corey. Corey Wirun wrote: > Hi All, > > This should be a simple question, but it is possible to, control the color > of text written to static text or an edit box? I need to do this at during > In...

Exchange 2003 SMTP QUIT
= = = = = = = = = = = = = = = = = = = = = = = = = = = PROBLEM: Problem is that OUR SERVER is sending QUIT-, instead of sending MAIL FROM: MY Server open a SMTP connection REMOTE Server says 220 .. MY Server says EHLO to REMOTE Server REMOTE Server says 250 ... MY Server then say QUIT ! (instead of MAIL FROM ....) We have::Exchange 2003 , cu SP1, pe Windows 2003.. Exchange has also IMF (spam filter from Microsoft) and Symantec Mail Security for Exchange 4.5. all PTR is installed and working OK. The SMTP Server is workin OK a while, then it start opening a lot of connections (7-10 /sec) t...

User accout shows new email
On start up a message shows in my user account that I have new email messages but am using Outlook 2003 and all incoming emails have been deleted. How do I clear the message ...

Variant type?
Hello I have a switch statement, and I receive a vValue.vt equal to 8204. I tested for VT_BSTR, VT_SAFEARRAY,... and none of these type values = 8204. What type value equals 8204? Thanks, Barbara void myBC::ResponseCallback(VARIANT vValue) { [...] switch(vValue.vt) { case VT_I4 : //VT_I4 has a value of 3 // do something break; case VT_??? //What has a value of 8204 ? // do something break; } } ...