concatenating mismatched wide strings

When attempting to assemble a string, I am getting the error "concatenating 
mismatched wide strings".  What would be the proper form for putting the 
string together and displaying it as a message?  I don't understand where 
the mismatch is.

  CString s;
  . . .
  s = _T("shape");
  . . .
   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
to be missing. \n We will now close the program, so that someone can 
reinstall the program.") );


0
srussell2458 (497)
6/12/2006 8:32:55 PM
vc.mfc 33608 articles. 0 followers. Follow

13 Replies
873 Views

Similar Articles

[PageSpeed] 45

The error message should include a line number. It seems like that could be 
helpful information. Did you go into the options and set Unicode as the 
character types, or are you defining _UNICODE/UNICODE manually? Is _UNICODE 
defined? What is sizeof(TCHAR)?

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...
> When attempting to assemble a string, I am getting the error 
> "concatenating mismatched wide strings".  What would be the proper form 
> for putting the string together and displaying it as a message?  I don't 
> understand where the mismatch is.
>
>  CString s;
>  . . .
>  s = _T("shape");
>  . . .
>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
> to be missing. \n We will now close the program, so that someone can 
> reinstall the program.") );
>
> 


0
jwood (1291)
6/12/2006 8:43:29 PM
"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...

> When attempting to assemble a string, I am getting the error 
> "concatenating mismatched wide strings".  What would be the proper form 
> for putting the string together and displaying it as a message?  I don't 
> understand where the mismatch is.
>
>  CString s;
>  . . .
>  s = _T("shape");
>  . . .
>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
> to be missing. \n We will now close the program, so that someone can 
> reinstall the program.") );

CString s;

....

s  +  _T("---------") ;       // is fine

_T("------") + s;            // isn't

You can add a nul-ternminted character array to a CString (to get a longer 
CString)  but you can't do it the other way around.

Try

CString t;
t.Format(  _T("A picture file by the name of  \" %s \" seems to be 
missing.\n" We will now close the program, so that someone can reinstall the 
program.");
AfxMessageBox( t );

Dave

-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm


0
dave1 (356)
6/12/2006 9:15:30 PM
My apologies -- I did neglect to mention that the line number in the error 
message referred to the AfxMessageBox line.

I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / Preprocessor / 
Preprocessor definitions.

A trace of sizeof(TCHAR) gives me 1.

Maybe this is leading to the same place as my other thread on Unicode. 
Perhaps I am lacking something in defining UNICODE, but I thought I had it 
all working.

"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:eLHhvDmjGHA.3496@TK2MSFTNGP04.phx.gbl...
> The error message should include a line number. It seems like that could 
> be helpful information. Did you go into the options and set Unicode as the 
> character types, or are you defining _UNICODE/UNICODE manually? Is 
> _UNICODE defined? What is sizeof(TCHAR)?
>
> -- 
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
> news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...
>> When attempting to assemble a string, I am getting the error 
>> "concatenating mismatched wide strings".  What would be the proper form 
>> for putting the string together and displaying it as a message?  I don't 
>> understand where the mismatch is.
>>
>>  CString s;
>>  . . .
>>  s = _T("shape");
>>  . . .
>>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
>> to be missing. \n We will now close the program, so that someone can 
>> reinstall the program.") );
>>
>>
>
> 


0
srussell2458 (497)
6/12/2006 9:26:05 PM
"David Webber" <dave@musical.demon.co.uk> wrote in message 
news:OriSpVmjGHA.1552@TK2MSFTNGP03.phx.gbl...
>
> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
> news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...
>
>> When attempting to assemble a string, I am getting the error 
>> "concatenating mismatched wide strings".  What would be the proper form 
>> for putting the string together and displaying it as a message?  I don't 
>> understand where the mismatch is.
>>
>>  CString s;
>>  . . .
>>  s = _T("shape");
>>  . . .
>>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
>> to be missing. \n We will now close the program, so that someone can 
>> reinstall the program.") );
>
> CString s;
>
> ...
>
> s  +  _T("---------") ;       // is fine
>
> _T("------") + s;            // isn't
>
> You can add a nul-ternminted character array to a CString (to get a longer 
> CString)  but you can't do it the other way around.
>
> Try
>
> CString t;
> t.Format(  _T("A picture file by the name of  \" %s \" seems to be 
> missing.\n" We will now close the program, so that someone can reinstall 
> the program.");
> AfxMessageBox( t );
>
> Dave
---------------
Thanks a lot, Dave.  I've been wondering about that for a long time.  And I 
have tried your t.Format method with good results.  [after fixing one or two 
typos:  t.Format(  _T("A picture file by the name of  \" %s \" seems to be 
missing.\nWe will now close the program, so that someone can reinstall the 
program.") ); ] 


0
srussell2458 (497)
6/12/2006 9:42:00 PM
Steve,

> My apologies -- I did neglect to mention that the line number in the error 
> message referred to the AfxMessageBox line.
>
> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / Preprocessor 
> / Preprocessor definitions.
>
> A trace of sizeof(TCHAR) gives me 1.
>
> Maybe this is leading to the same place as my other thread on Unicode. 
> Perhaps I am lacking something in defining UNICODE, but I thought I had it 
> all working.

If sizeof(TCHAR) is 1, then not everything is Unicode.

You can toggle the Unicode setting in the project properties dialog box. 
There is a setting for the active character set. I STRONGLY urge you to 
remove all the stuff you've added manually and use that setting.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


0
jwood (1291)
6/12/2006 9:44:01 PM
"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
> Steve,
>
>> My apologies -- I did neglect to mention that the line number in the 
>> error message referred to the AfxMessageBox line.
>>
>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / Preprocessor 
>> / Preprocessor definitions.
>>
>> A trace of sizeof(TCHAR) gives me 1.
>>
>> Maybe this is leading to the same place as my other thread on Unicode. 
>> Perhaps I am lacking something in defining UNICODE, but I thought I had 
>> it all working.
>
> If sizeof(TCHAR) is 1, then not everything is Unicode.
>
> You can toggle the Unicode setting in the project properties dialog box. 
> There is a setting for the active character set. I STRONGLY urge you to 
> remove all the stuff you've added manually and use that setting.
------------
Well, the fallacy in my measure of TCHAR is that the only way I could run 
the program was to remove the Unicode entries in the Preprocessor 
definitions.

By "project properties dialog box" do you mean the Project Settings?  Would 
you mind pointing me to the "toggle switch" you are referring to? 


0
srussell2458 (497)
6/12/2006 10:00:16 PM
Project | <appname> Properties | Configuration Properties | General | 
Character Set. (Set to multibyte for non-Unicode.)

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:ui%23uFumjGHA.5020@TK2MSFTNGP02.phx.gbl...
> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
> news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
>> Steve,
>>
>>> My apologies -- I did neglect to mention that the line number in the 
>>> error message referred to the AfxMessageBox line.
>>>
>>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / 
>>> Preprocessor / Preprocessor definitions.
>>>
>>> A trace of sizeof(TCHAR) gives me 1.
>>>
>>> Maybe this is leading to the same place as my other thread on Unicode. 
>>> Perhaps I am lacking something in defining UNICODE, but I thought I had 
>>> it all working.
>>
>> If sizeof(TCHAR) is 1, then not everything is Unicode.
>>
>> You can toggle the Unicode setting in the project properties dialog box. 
>> There is a setting for the active character set. I STRONGLY urge you to 
>> remove all the stuff you've added manually and use that setting.
> ------------
> Well, the fallacy in my measure of TCHAR is that the only way I could run 
> the program was to remove the Unicode entries in the Preprocessor 
> definitions.
>
> By "project properties dialog box" do you mean the Project Settings? 
> Would you mind pointing me to the "toggle switch" you are referring to?
> 


0
jwood (1291)
6/12/2006 11:40:36 PM
Are you describing something later than 6.0?  I don't have such a properties 
choice under Project in the menu.
-----------
"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:OHfBvmnjGHA.3620@TK2MSFTNGP02.phx.gbl...
> Project | <appname> Properties | Configuration Properties | General | 
> Character Set. (Set to multibyte for non-Unicode.)
>
> -- 
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
> news:ui%23uFumjGHA.5020@TK2MSFTNGP02.phx.gbl...
>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>> news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
>>> Steve,
>>>
>>>> My apologies -- I did neglect to mention that the line number in the 
>>>> error message referred to the AfxMessageBox line.
>>>>
>>>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / 
>>>> Preprocessor / Preprocessor definitions.
>>>>
>>>> A trace of sizeof(TCHAR) gives me 1.
>>>>
>>>> Maybe this is leading to the same place as my other thread on Unicode. 
>>>> Perhaps I am lacking something in defining UNICODE, but I thought I had 
>>>> it all working.
>>>
>>> If sizeof(TCHAR) is 1, then not everything is Unicode.
>>>
>>> You can toggle the Unicode setting in the project properties dialog box. 
>>> There is a setting for the active character set. I STRONGLY urge you to 
>>> remove all the stuff you've added manually and use that setting.
>> ------------
>> Well, the fallacy in my measure of TCHAR is that the only way I could run 
>> the program was to remove the Unicode entries in the Preprocessor 
>> definitions.
>>
>> By "project properties dialog box" do you mean the Project Settings? 
>> Would you mind pointing me to the "toggle switch" you are referring to?
>>
>
> 


0
srussell2458 (497)
6/12/2006 11:51:30 PM
Yes, 2 versions have been released since 6.0. Both of them use the described 
switch to set the character set. I don't recall 6.0--haven't used it for 
many, many years.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:uKCbOsnjGHA.3496@TK2MSFTNGP04.phx.gbl...
> Are you describing something later than 6.0?  I don't have such a 
> properties choice under Project in the menu.
> -----------
> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
> news:OHfBvmnjGHA.3620@TK2MSFTNGP02.phx.gbl...
>> Project | <appname> Properties | Configuration Properties | General | 
>> Character Set. (Set to multibyte for non-Unicode.)
>>
>> -- 
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
>> news:ui%23uFumjGHA.5020@TK2MSFTNGP02.phx.gbl...
>>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>>> news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
>>>> Steve,
>>>>
>>>>> My apologies -- I did neglect to mention that the line number in the 
>>>>> error message referred to the AfxMessageBox line.
>>>>>
>>>>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / 
>>>>> Preprocessor / Preprocessor definitions.
>>>>>
>>>>> A trace of sizeof(TCHAR) gives me 1.
>>>>>
>>>>> Maybe this is leading to the same place as my other thread on Unicode. 
>>>>> Perhaps I am lacking something in defining UNICODE, but I thought I 
>>>>> had it all working.
>>>>
>>>> If sizeof(TCHAR) is 1, then not everything is Unicode.
>>>>
>>>> You can toggle the Unicode setting in the project properties dialog 
>>>> box. There is a setting for the active character set. I STRONGLY urge 
>>>> you to remove all the stuff you've added manually and use that setting.
>>> ------------
>>> Well, the fallacy in my measure of TCHAR is that the only way I could 
>>> run the program was to remove the Unicode entries in the Preprocessor 
>>> definitions.
>>>
>>> By "project properties dialog box" do you mean the Project Settings? 
>>> Would you mind pointing me to the "toggle switch" you are referring to?
>>>
>>
>>
>
> 


0
jwood (1291)
6/13/2006 1:00:06 AM
Okay, thank you, Jonathan.  I will stay with what I learned from MVP Mihai 
Nita:

> Or is this the same as including UNICODE,_UNICODE in the preprocessor 
> definitions under Settings?
Yes, is the same. Depending on what version of VS you are using, you
have to add the defines by hand as preprocessor directives ( VS6 and older),
or just select Unicode build from a menu (VS2002/2003/2005).
---------
"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:OwTLKTojGHA.4044@TK2MSFTNGP03.phx.gbl...
> Yes, 2 versions have been released since 6.0. Both of them use the 
> described switch to set the character set. I don't recall 6.0--haven't 
> used it for many, many years.
>
> -- 
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
> news:uKCbOsnjGHA.3496@TK2MSFTNGP04.phx.gbl...
>> Are you describing something later than 6.0?  I don't have such a 
>> properties choice under Project in the menu.
>> -----------
>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>> news:OHfBvmnjGHA.3620@TK2MSFTNGP02.phx.gbl...
>>> Project | <appname> Properties | Configuration Properties | General | 
>>> Character Set. (Set to multibyte for non-Unicode.)
>>>
>>> -- 
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>
>>> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
>>> news:ui%23uFumjGHA.5020@TK2MSFTNGP02.phx.gbl...
>>>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>>>> news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
>>>>> Steve,
>>>>>
>>>>>> My apologies -- I did neglect to mention that the line number in the 
>>>>>> error message referred to the AfxMessageBox line.
>>>>>>
>>>>>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / 
>>>>>> Preprocessor / Preprocessor definitions.
>>>>>>
>>>>>> A trace of sizeof(TCHAR) gives me 1.
>>>>>>
>>>>>> Maybe this is leading to the same place as my other thread on 
>>>>>> Unicode. Perhaps I am lacking something in defining UNICODE, but I 
>>>>>> thought I had it all working.
>>>>>
>>>>> If sizeof(TCHAR) is 1, then not everything is Unicode.
>>>>>
>>>>> You can toggle the Unicode setting in the project properties dialog 
>>>>> box. There is a setting for the active character set. I STRONGLY urge 
>>>>> you to remove all the stuff you've added manually and use that 
>>>>> setting.
>>>> ------------
>>>> Well, the fallacy in my measure of TCHAR is that the only way I could 
>>>> run the program was to remove the Unicode entries in the Preprocessor 
>>>> definitions.
>>>>
>>>> By "project properties dialog box" do you mean the Project Settings? 
>>>> Would you mind pointing me to the "toggle switch" you are referring to?
>>>>
>>>
>>>
>>
>>
>
> 


0
srussell2458 (497)
6/13/2006 1:11:25 AM
"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...

> When attempting to assemble a string, I am getting the error 
> "concatenating mismatched wide strings".

Half of the error is in the error message.  The mismatch is between a wide 
string and a multibyte string, not between two wide strings.

>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
> to be missing. \n We will now close the program, so that someone can 
> reinstall the program.") );

In a multibyte compilation _T would expand to nothing and your program would 
compile, but results would be different from what you expect.  This would 
help you find your error.

In a Unicode compilation _T expands to a prefix L.  But that prefix only 
attaches to the first string in the argument of _T.  So this:
  _T("A picture file by the name of """)
will turn into this:
  L"A picture file by the name of """
In the C++ language itself (i.e. not invoking an MFC function), you cannot 
concatenate L"A picture file by the name of " with "".  You can concatenate 
two wide strings or concatenate two multibyte strings, but you cannot 
concatenate one wide string with one multibyte string.

Of course you probably didn't want to concatenate string "" to anything, 
because it only wastes time typing and compiling but it doesn't accomplish 
anything.  You probably wanted this:
  _T("A picture file by the name of \"") 

0
ndiamond1 (258)
6/13/2006 1:24:21 AM
"Norman Diamond" <ndiamond@community.nospam> wrote in message 
news:u9hwggojGHA.3572@TK2MSFTNGP04.phx.gbl...
> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
> news:eirfQ9ljGHA.4508@TK2MSFTNGP05.phx.gbl...
>
>> When attempting to assemble a string, I am getting the error 
>> "concatenating mismatched wide strings".
>
> Half of the error is in the error message.  The mismatch is between a wide 
> string and a multibyte string, not between two wide strings.
>
>>   AfxMessageBox(_T("A picture file by the name of """) + s + _T(""" seems 
>> to be missing. \n We will now close the program, so that someone can 
>> reinstall the program.") );
>
> In a multibyte compilation _T would expand to nothing and your program 
> would compile, but results would be different from what you expect.  This 
> would help you find your error.
>
> In a Unicode compilation _T expands to a prefix L.  But that prefix only 
> attaches to the first string in the argument of _T.  So this:
>  _T("A picture file by the name of """)
> will turn into this:
>  L"A picture file by the name of """
> In the C++ language itself (i.e. not invoking an MFC function), you cannot 
> concatenate L"A picture file by the name of " with "".  You can 
> concatenate two wide strings or concatenate two multibyte strings, but you 
> cannot concatenate one wide string with one multibyte string.
>
> Of course you probably didn't want to concatenate string "" to anything, 
> because it only wastes time typing and compiling but it doesn't accomplish 
> anything.  You probably wanted this:
>  _T("A picture file by the name of \"")
------------
This is very helpful.  Thank you for the education, Norman! 


0
srussell2458 (497)
6/13/2006 1:41:55 AM
Okay. I would just add that if they have been defined correctly, 
sizeof(TCHAR) should be 2.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Steve Russell" <srussell@removethisinnernet.net> wrote in message 
news:OydK4YojGHA.1640@TK2MSFTNGP02.phx.gbl...
> Okay, thank you, Jonathan.  I will stay with what I learned from MVP Mihai 
> Nita:
>
>> Or is this the same as including UNICODE,_UNICODE in the preprocessor 
>> definitions under Settings?
> Yes, is the same. Depending on what version of VS you are using, you
> have to add the defines by hand as preprocessor directives ( VS6 and 
> older),
> or just select Unicode build from a menu (VS2002/2003/2005).
> ---------
> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
> news:OwTLKTojGHA.4044@TK2MSFTNGP03.phx.gbl...
>> Yes, 2 versions have been released since 6.0. Both of them use the 
>> described switch to set the character set. I don't recall 6.0--haven't 
>> used it for many, many years.
>>
>> -- 
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
>> news:uKCbOsnjGHA.3496@TK2MSFTNGP04.phx.gbl...
>>> Are you describing something later than 6.0?  I don't have such a 
>>> properties choice under Project in the menu.
>>> -----------
>>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>>> news:OHfBvmnjGHA.3620@TK2MSFTNGP02.phx.gbl...
>>>> Project | <appname> Properties | Configuration Properties | General | 
>>>> Character Set. (Set to multibyte for non-Unicode.)
>>>>
>>>> -- 
>>>> Jonathan Wood
>>>> SoftCircuits Programming
>>>> http://www.softcircuits.com
>>>>
>>>> "Steve Russell" <srussell@removethisinnernet.net> wrote in message 
>>>> news:ui%23uFumjGHA.5020@TK2MSFTNGP02.phx.gbl...
>>>>> "Jonathan Wood" <jwood@softcircuits.com> wrote in message 
>>>>> news:%233CaklmjGHA.1508@TK2MSFTNGP04.phx.gbl...
>>>>>> Steve,
>>>>>>
>>>>>>> My apologies -- I did neglect to mention that the line number in the 
>>>>>>> error message referred to the AfxMessageBox line.
>>>>>>>
>>>>>>> I added ",UNICODE,_UNICODE" under Project Settings / C/C++ / 
>>>>>>> Preprocessor / Preprocessor definitions.
>>>>>>>
>>>>>>> A trace of sizeof(TCHAR) gives me 1.
>>>>>>>
>>>>>>> Maybe this is leading to the same place as my other thread on 
>>>>>>> Unicode. Perhaps I am lacking something in defining UNICODE, but I 
>>>>>>> thought I had it all working.
>>>>>>
>>>>>> If sizeof(TCHAR) is 1, then not everything is Unicode.
>>>>>>
>>>>>> You can toggle the Unicode setting in the project properties dialog 
>>>>>> box. There is a setting for the active character set. I STRONGLY urge 
>>>>>> you to remove all the stuff you've added manually and use that 
>>>>>> setting.
>>>>> ------------
>>>>> Well, the fallacy in my measure of TCHAR is that the only way I could 
>>>>> run the program was to remove the Unicode entries in the Preprocessor 
>>>>> definitions.
>>>>>
>>>>> By "project properties dialog box" do you mean the Project Settings? 
>>>>> Would you mind pointing me to the "toggle switch" you are referring 
>>>>> to?
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> 


0
jwood (1291)
6/13/2006 3:05:54 AM
Reply:

Similar Artilces:

When concatenating concatenates don't concatenate...
Hi List, Can anyone help? When concatenating already-concatenated cells, th result displays perfectly well in the Excel spreadsheet, but truncate when the cell is pasted into a .txt file. It doesn't seem to be due t Data Validation limits (having said that, selecting the entir worksheet and doing Alt > Data > Validation > Validation criteria Allow = Any value" did seem to solve the problem once, but only to com back next time round). The truncation occurs sometimes after 8 or 1 chars, and sometimes after 20 or so, always at the same spot. If I cop the cell into a fresh Excel...

Concatenate function
Hi, How can I concatenate these 2 cells: one is time and the other is text: 9:00 and AM and I want the result to be 9:00 AM =CONCATENATE(AD2, " ", AE2) I have tried different formating cells but it doesn't work, this is what I get: 0.375 AM Thanks for your help. NSNR - You must format the time (which is a number) to text: =TEXT(AD2,"H:MM") & " " & AE2 -- Daryl S "NSNR" wrote: > Hi, > How can I concatenate these 2 cells: one is time and the other is text: 9:00 > and AM and I want the result to be ...

Concatenating Cells
I have spent hours this afternoon in Excel 2003 trying to concatenate two adjacent text columns into a third column defined as Text format. It doesn't work, the result cell just displays the formula you enter {e.g. =A1&B1 or =CONCATENATE(A1,B1)}. I discovered after a great deal of frustration that this will only work if the cell containing the formula is formatted as '*General'*. All the MS command help refers to the data being concatenated as 'text' data as does the command help that displays as you type. I found no help on this on the MS site and trawling the w...

IF and Concatenate
Hi I have a following chart which list out delivery dates arcross the top with items and units on the body of the chart (dashes are spaces) On the right column is the results that I need. What kind of formula can I use to return such results? I thought that I can use IF and Concatenate formula (IF, ordered units, then seek out date....). Not even sure I can use IF, since in my real chart, I have more than 20+ dates going across. Any help would be much appreciated! Style---7/30---8/13----8/14----8/15---8/17--------Wanted-Result 66106-------------------------------9--------5--------9 DUE ...

When concatenating concatenates don't concatenate... #3
Sometimes the simplest thing... I didn't realise that all the files ha to be open for the concatenation to work :rolleyes: . Doing s eliminates the problem and explains the erratic behaviour. And yes, th idea is to blend the variable and unvariable parts of an html pag together by pasting the final concatenation into a notepad.txt file Primitive, but interim. Thank you very much for your help. Best regards d'A -- d'A ----------------------------------------------------------------------- d'Az's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1504 ...

String tables...
Hi, I have lots of #define values used in my project. I have put them all in a separate file called definitions.h and this file is available for all the files in the project. Can I remove this file and and use the string table instead? Pls advise. Thanks, Shirley If I understand the question, then yes. In fact, the recommended way would be to create a string table resource for your application. You then use LoadString to load one of the strings. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com "Shirley" <shirley2972@yahoo.com> wrote in message ne...

? Define Constant Name Strings to Integer Values
Hi, I'm looking for a way to convert a defined constant from its name to its value. For example I need a way to take the input string "VK_ESCAPE" and derive its integer value 0x1b. Most scripting languages do this through the eval function, but I cannot figure out a way to accomplish this with VC++. (I'm writing a dialog app, and I need a way to allow the user to pass key names on the command line without reinventing an entire key-map.) Any ideas? Thanks. -- Alec S. news/alec->synetech/cjb/net There may be a trickier way, but I would just build a switch statement...

Transform XML string using XSL file (v1.1)
Having fits transforming an XML string using an XSL file. In the 1.1 version of the framework, I see that the XmlResolver is heavily used in the XslTransform class. However, that looks like I am only supposed to use that only when you have an xml ~file~... not an XML string (my XML is coming from a database field). Is there a cut & dry example out there on how to transform a simple XML string using XSL? -AC I believe that you can use Nothing for the XMLResolver parameter in VB.Net or null in C# if you so choose, thereby not enforcing the Security enhancements. ms-help://MS.MSDNQTR.20...

Concatenate cells without specifying/writing cell address individually
Hi, Let's say I have text "we45t" in A1, "yuui6" in A2, "sfdgfd5" in A3 and so on till A45. (basically the text in each of the columns are different/random) Now I have to concatenate all the cells from A1 to A45 (with a single space between any 2 joinees) in to a single cell B1. I can get the job done by using a) = Concatenate (A1," ",A2," ",A3," ",A4," ",A5," ",A6," ",.......) and so till A45 b) =A1&" "&A2&" "&A3&" "&A47" "&A5&...

Non-Unicode strings in VB.NET?
I've been reading the MSDN documentation on the System.Char and System.String types and they mention Unicode throughout without even mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and non-Unicode string in .NET? Thanks, Alain > I've been reading the MSDN documentation on the System.Char and > System.String types and they mention Unicode throughout without even > mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and > non-Unicode string in .NET? You don't. You can get a byte array, but there ...

copy string
I would like to copy first 255 characters of string to strNewString Are there any functions to copy the first 255 characters in to my string? Your infroamtion is great apprecaietd, "Souris" <Souris@discussions.microsoft.com> wrote in message news:D0C0810A-CC31-41F1-A5B8-DFB9B52D6218@microsoft.com... >I would like to copy first 255 characters of string to strNewString > > Are there any functions to copy the first 255 characters in to my string? strNewSting = Left(string, 255) Tom Lake Thanks millions, "Tom Lake" wrote: > > "Souris&quo...

problem installing a system-wide hook
I am having trouble installing a system-wide hook (WH_CBT) using SetWindowsHookEx. I have build a DLL which contains my hook procedure and I dynamically load this DLL in my calling application, get the hook proc address, and call SetWindowsHookEx with the thread parameter as NULL. However, when I debug, the hook proc only gets called when windows are created, deactivated, etc for my application, instead I wanted the proc to be called for ANY window creation, activation, etc. I have tried a number of things but I don't understand why I am only able to hook events of my calling application i...

Concatenate with delimiter
I have some text that I need to concatenate, but with a delimiter. Three strings, A, B, C, where A and C are complicated expressions and B is a space-dash-space. I want the separator only if BOTH A and C are non-empty, otherwise only A or C (or nothing, if they're both empty). I've been playing with IsNull and NullIf functions, trying to influence the concatenation, but haven't come up with anything useful. Doesn't T-SQL have a function that is the opposite of Split? Pete -- This e-mail address is fake, to keep spammers and their address harvesters ou...

Finding a string within a string #2
New problem - suppose the string is aaa (bbb@ccc.com) ddd or aaaaaaaaaaaaa (bbbbbbbbbbbbbbbb@ccccccccccccc.com) dddddddddd and you want only the string after the open parenthesis and before the @ ??? So the results for these 2 strings would be either bbb or bbbbbbbbbbbbbbbb "Sandra" <ab@mdahospital.com> wrote in message news:OZU1oZaoEHA.132@TK2MSFTNGP14.phx.gbl... > The comma thing worked. Thank you VERY much! > > "Frank Kabel" <frank.kabel@freenet.de> wrote in message > news:%23AQ2RPaoEHA.2684@TK2MSFTNGP11.phx.gbl... > > Hi > > if y...

DQBL String [WILDPACKET]
Want to create a string which creates a DL which populates the Contacts from entire organization and Active accounts only from abc.com domain. Help is appreciated, I am kind of stuck. Thank you. ...

Formating a text string?
I use subscripting in Excel for text cells, but would like to subscript in a text string that includes numbers. For example, I need to subscript the "x" in Standard Deviation = 0.125 lbs/hr NOx. Is there a way of doing this? Hi select this character in the formula bar and goto format - cells -- Regards Frank Kabel Frankfurt, Germany "METCO1" <METCO1@discussions.microsoft.com> schrieb im Newsbeitrag news:59975300-0600-4A98-886F-52F735F87E12@microsoft.com... > I use subscripting in Excel for text cells, but would like to subscript in a > text string that in...

=Concatenate
Hi, I am using this formula: =(A1&", "&B1&", "&C1&", "&D1&", "&E1&", "&F1) Problem is, sometimes a few of the cells are blank. I end up getting 2 commas , , together. I would like to add a conditional that would check to see if the cell is blank. If so, skip the cell. How would I do that? Thank you. David Hi David, This doesn't check for blanks beforehand, it cleans them up afterwards. =SUBSTITUTE((A1&", "&B1&", "&C1&", "&D1&", &...

Concatenating Rich Textbox Controls Into A Single File
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to concatenate several RTB controls into a single RTF file. Sometimes two strings will be side-by-side; other times they need to be separated by a hard return. For example, say I have the following 4 RTB controls in my form: RTB1 = "abcd" RTB2 = "efgh" RTB3 = "ijkl" RTB4 = "mnop" The resulting RTF document might need to look like this: abcdefgh ijkl mnop Using the SaveFile method works great for a single RTB control. But how can I concatenate the contents of two or more controls into ...

String Table #2
I am getting ready to paste hundreds of string table entries into my .rc file. Could I get some advice on how to proceed with: STRINGTABLE DISCARDABLE BEGIN . . . END ? I can't say I truly understand what STRINGTABLE DISCARDABLE does. "Steve Russell" <srussell@removethisinnernet.net> wrote in message news:eAchxUVnFHA.2472@tk2msftngp13.phx.gbl... >I am getting ready to paste hundreds of string table entries into my .rc >file. Could I get some advice on how to proceed with: > > STRINGTABLE DISCARDABLE > BEGIN > . . . > END > ? > > ...

Un-Install string lost
Hello to all We all know those little programs that mis-behave and you can't kick them out because they even lack the un-install string. But one need not worry (I think) when installing a program from a big reputable company as Intel but this is my problem. I installed an Intel Camera program called "Intel create and share" that isn't working at all. I tried to remove it via the ADD/REmove page but no joy there. The program name do exist on the Add/Remove page but clicking delete will not remove it. I checked the program folder on the HDD and it has a sub fold...

Concatenate and format
Concatenate and format Hey there. Have a large spreadsheet of stock transactions. Currently have a column for number of shares and another column for symbol. I want to concatenate into one cell and keep the share amount right justified and the description left justified. Old 1000 CSCO 50 XLNX These are in separate columns But when I concatenate I get 1000 CSCO 50 XLNX How can I get the info in one cell and nicely formatted? Thanks Adam Adam, Main problem is that most fonts will invalidate anything you do, as some characters will display wider than others. So, if you had a formul...

reverse of concatenate
I am in search for the option which is opposite to concatenate. (that is if we type in different columns it can be combined ) in one column. like that i am looking for a command in which we type all the text strings will be broken into different columns pls help thanks in advance If you can use some character (e.g. space) as a separator, you can use Tools - text to columns - Delimited... Select the column first. Aa "S.G.Pillai" wrote: > I am in search for the option which is opposite to concatenate. (that is if > we type in different columns it can be combined ) in one...

Search All worksheets for string & Create new Whorsheet with the Original Sheet Name and some cells.d some
I am running Excel 97 SR-1. Here is what I want to do: I have a workbook that has many worksheets- all the sheets are in the same format. I would like to be able to search through the entire workbook and copy all rows that contain my "FIND DATA" to a new worksheet. The find data is really a name. Here are the specifics - The new worksheet would have the original(found) worksheet name in cell A, and all the data from the original cells ,in cells B through J, put in cells b through J. I am working on a macro to do this, but I am not having too much luck. I have searched this group...

Concatenation help
I have 3 cells I need to merge into one. One of the cells is a number anywhere from 1-16 or more. What I need is for the number in this cells to always be concatenated into a 2 digit number. Example: Cell A1 = USA123-4555678952 Cell A2 = CD Cell A3 = 4 I need the final output to be 234555678952CD04. So far I have the following formula: =RIGHT(LEFT(A1,5)&RIGHT(A1,10),12)&A2&A3 but this doesn't put "04" after the CD. It only puts "4" after it. Any ideas for Excel 2003? Thanks. A tiny trick: =RIGHT(LEFT(A1,5)&RIGHT(A1,10),12)&A2&a...

Count Unique Strings
I am trying to count "unique" items and I have tried the different suggestions out there and itis still coming up incorrect. What I have: (These are text values, and have to remain that way.) 00000002756 00000002766 00000002771 00000002771 00000039981 00000185817 00000195933 00000195933 00000195933 00000195933 So, my count should be 5. I am using the formula: =SUM(IF(FREQUENCY(MATCH(Range1,Range1,0),MATCH(Range1,Range1,0))>0,1)) And my total keeps coming up with 6. What am I doing wrong? Any help will be appreciated. Thanks. Stacy Hi Stacey, > So, my count should be 5. ...