Difference between chr(34) and chr(160) 
Author Message
 Difference between chr(34) and chr(160)

I have a list box in a VB6 application.  Each row in the list box
contains three strings.  I'm trying to figure out what to use divide
each string from the others.  Playing around a bit I found out that my
keyboard seems to send a chr(34) when I press the space bar.  Therefore,
I was thinking about using chr(160) & "-" & chr(160) to divide each
string from the other.  Since I'd like the user to be able to use the
"-" to name things.  Other than typing Alt + 0160 is there any way that
a user could type a chr(160)?
--
Eric Goforth
Senior Applications Programmer
SimTek, Inc.
6008-D High Point Rd.
Greensboro, NC 27407
Phone (336) 454-0006
Fax   (336) 454-0014


Sun, 21 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
Some programs assign "special keys" to do a task. Not very pleasant, but how
about a simpler key-combination, for example Shift and Space at the same
time. On the other hand you can use a null character as the seperator.

Later,

=================
Richard
ICQ: 8916422
=================


Quote:
> I have a list box in a VB6 application.  Each row in the list box
> contains three strings.  I'm trying to figure out what to use divide
> each string from the others.  Playing around a bit I found out that my
> keyboard seems to send a chr(34) when I press the space bar.  Therefore,
> I was thinking about using chr(160) & "-" & chr(160) to divide each
> string from the other.  Since I'd like the user to be able to use the
> "-" to name things.  Other than typing Alt + 0160 is there any way that
> a user could type a chr(160)?
> --
> Eric Goforth
> Senior Applications Programmer
> SimTek, Inc.
> 6008-D High Point Rd.
> Greensboro, NC 27407
> Phone (336) 454-0006
> Fax   (336) 454-0014



Sun, 21 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
Check out the KeyPress event
Private Sub object_KeyPress([index As Integer,]keyascii As Integer)
    if keyascii = 126 then keyascii = 160
end sub

check the keyascii of each keypress and if the keyascii matches say ~ (tilde
acsii 126) set keyascii to 160
there fore the user can type string 1 ~-~ string2 ~-~ string 3
which will appear (as if the user typed) string 1 chr(160)-chr(160) . . . .
Hope this helps
RobZ

Quote:

>I have a list box in a VB6 application.  Each row in the list box
>contains three strings.  I'm trying to figure out what to use divide
>each string from the others.  Playing around a bit I found out that my
>keyboard seems to send a chr(34) when I press the space bar.  Therefore,
>I was thinking about using chr(160) & "-" & chr(160) to divide each
>string from the other.  Since I'd like the user to be able to use the
>"-" to name things.  Other than typing Alt + 0160 is there any way that
>a user could type a chr(160)?
>--
>Eric Goforth
>Senior Applications Programmer
>SimTek, Inc.
>6008-D High Point Rd.
>Greensboro, NC 27407
>Phone (336) 454-0006
>Fax   (336) 454-0014



Sun, 21 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
It would be very difficult if at all possible for a user to type in a
chr(160).  Based on my reading of your post, I think that you will
consider that to be a good thing.  If you don't mind taking a suggestion,
why not use the list control that is part of the Windows Common Controls
instead of the list box.  Set the list control to report view (I think VB
calls this report style).  This is the same control that is used by
Windows Explorer, with the report view being what you get when you set
Explorer's view options to Details.  With it set to report view, you get
columns with resizable headers.  With very little coding you can also have
the list items sort when the header is clicked.  It takes a little more
coding to get items into a list control, you can't simply call .AddItem,
but it is much cleaner for multiple columns of data.

--
Tom Porterfield
MS-MVP


Quote:
> I have a list box in a VB6 application.  Each row in the list box
> contains three strings.  I'm trying to figure out what to use divide
> each string from the others.  Playing around a bit I found out that my
> keyboard seems to send a chr(34) when I press the space bar.  Therefore,
> I was thinking about using chr(160) & "-" & chr(160) to divide each
> string from the other.  Since I'd like the user to be able to use the
> "-" to name things.  Other than typing Alt + 0160 is there any way that
> a user could type a chr(160)?
> --
> Eric Goforth
> Senior Applications Programmer
> SimTek, Inc.
> 6008-D High Point Rd.
> Greensboro, NC 27407
> Phone (336) 454-0006
> Fax   (336) 454-0014



Sun, 21 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
Another option is to give the user a button to click to insert the
character.  The button click event would simply add chr$(160) & "-" &
Chr$(160) to the contents of the text box where the user is entering the
strings.  Or, ask the user to enter the three strings in separate text
boxes, then you concatenate them using chr$(160) & "-" & Chr$(160) before
adding the whole string to the list.

Be aware that unless you are explicitly setting the font for the list box,
not all users might see the same character for Chr$(160) - it could depend
on the font they have selected for the default.
--
Jeff Richards
1999 MVP (DTS)


Quote:
> I have a list box in a VB6 application.  Each row in the list box
> contains three strings.  I'm trying to figure out what to use divide
> each string from the others.  Playing around a bit I found out that my
> keyboard seems to send a chr(34) when I press the space bar.  Therefore,
> I was thinking about using chr(160) & "-" & chr(160) to divide each
> string from the other.  Since I'd like the user to be able to use the
> "-" to name things.  Other than typing Alt + 0160 is there any way that
> a user could type a chr(160)?
> --
> Eric Goforth
> Senior Applications Programmer
> SimTek, Inc.
> 6008-D High Point Rd.
> Greensboro, NC 27407
> Phone (336) 454-0006
> Fax   (336) 454-0014



Mon, 22 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)


Quote:
> I have a list box in a VB6 application.  Each row in the list box
> contains three strings.  I'm trying to figure out what to use divide
> each string from the others.  Playing around a bit I found out that my
> keyboard seems to send a chr(34) when I press the space bar.

Funny, that, mine sends a Chr(32)....  :)

Chr(34) is the double quote character - "

Christina

--
Christina West



Mon, 22 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
I've read over all the responses.  The one that looks best is the three text
boxes plus an "Add" button option.  You want the desired action to be as
obvious as possible.  It sounds like your real problem is that of user
interface layout.  Would you be interested in posting your current screen
layout to a web page for us to view.  We could then give you some ideas on
how to change the screen layout.

BTW, having the user edit things in a list box isn't terribly obvious to the
user.  Ditto for the suggestion of hacking the list report view.  Just
because you can do something doesn't make it a good idea.

You may also want to consider replacing your list box with a grid control.
This would leave your UI pretty much the same and data entry would be
obvious to the user.  Still, I'd like to see an actual screen shot before I
gave my opinion.


Quote:
> I have a list box in a VB6 application.  Each row in the list box
> contains three strings.  I'm trying to figure out what to use divide
> each string from the others.  Playing around a bit I found out that my
> keyboard seems to send a chr(34) when I press the space bar.  Therefore,
> I was thinking about using chr(160) & "-" & chr(160) to divide each
> string from the other.  Since I'd like the user to be able to use the
> "-" to name things.  Other than typing Alt + 0160 is there any way that
> a user could type a chr(160)?
> --
> Eric Goforth
> Senior Applications Programmer
> SimTek, Inc.
> 6008-D High Point Rd.
> Greensboro, NC 27407
> Phone (336) 454-0006
> Fax   (336) 454-0014



Mon, 22 Apr 2002 03:00:00 GMT  
 Difference between chr(34) and chr(160)
Each item in the list box is the primary key to an MS Access table,
although the list box isn't a databound control.  I decided to use:

chr(160) & chr(166) & chr(160)

as my separator.

Chr(166) appears to be an alternate pipe symbol that's different than
the one that I get when I type Shift + "\" on my keyboard.

So I build the listbox something like the following:

lstFabric.AddItem MyName(i) & Chr(160) & Chr(166) & Chr(160) _
& MyLot(i) & Chr(160) & Chr(166) & Chr(160) _
& MyTimestamp(i)

The user sees something like:

MyName1?|?MyLot1?|?1/1/1999
MyName2?|?MyLot2?|?1/2/1999
MyName3?|?MyLot3?|?1/3/1999

The user can then use anything that they want for MyName(i) and
MyLot(i), as long as they don't type a Alt+0160 Alt+0166 and another
Alt+0160  when they're filling out this information.  These two values
are input via text boxes  I suppose that I should add some trapping to
make sure that they don't enter this sequence in their textboxes, but it
seems highly unlikely that they would do this.

Then, when the user clicks on an item in the list box I do the following
to extract the key to look up the data in the database:

vntMyList = Split(lstMyList.List(lstMyList.ListIndex), Chr(160) &
Chr(166) & Chr(160), 3, vbTextCompare)

MyName = vntFabricList(0)
MyBatch = vntFabricList(1)
MyTimeStamp = vntFabricList(2)

Quote:

> I've read over all the responses.  The one that looks best is the three text
> boxes plus an "Add" button option.  You want the desired action to be as
> obvious as possible.  It sounds like your real problem is that of user
> interface layout.  Would you be interested in posting your current screen
> layout to a web page for us to view.  We could then give you some ideas on
> how to change the screen layout.

> BTW, having the user edit things in a list box isn't terribly obvious to the
> user.  Ditto for the suggestion of hacking the list report view.  Just
> because you can do something doesn't make it a good idea.

> You may also want to consider replacing your list box with a grid control.
> This would leave your UI pretty much the same and data entry would be
> obvious to the user.  Still, I'd like to see an actual screen shot before I
> gave my opinion.



> > I have a list box in a VB6 application.  Each row in the list box
> > contains three strings.  I'm trying to figure out what to use divide
> > each string from the others.  Playing around a bit I found out that my
> > keyboard seems to send a chr(34) when I press the space bar.  Therefore,
> > I was thinking about using chr(160) & "-" & chr(160) to divide each
> > string from the other.  Since I'd like the user to be able to use the
> > "-" to name things.  Other than typing Alt + 0160 is there any way that
> > a user could type a chr(160)?
> > --
> > Eric Goforth
> > Senior Applications Programmer
> > SimTek, Inc.
> > 6008-D High Point Rd.
> > Greensboro, NC 27407
> > Phone (336) 454-0006
> > Fax   (336) 454-0014

--
Eric Goforth
Senior Applications Programmer
SimTek, Inc.
6008-D High Point Rd.
Greensboro, NC 27407
Phone (336) 454-0006
Fax   (336) 454-0014


Tue, 23 Apr 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. - Major automotive website (Posted 23/10/2000 13:30:34.160)

2. chr$(34)

3. VB - Strange Happenings using Chr(34) ""

4. chr (34)

5. one " inside string without Chr(34)

6. What is Chr(34)?

7. String problem - chr(34) write to file

8. CHR vs CHR$

9. chr(10) and chr(13) in memofield gives |

10. Chr(10) & Chr(13)

11. Display chr$(30) & chr$(31)

12. Chr(10) and Chr(13) doesn't work

 

 
Powered by phpBB® Forum Software