| How to filter lower case characters in an edit control? |
|
 |
Index ‹ Visual Studio ‹ MFC
|
- Previous
- 1
- 2
- Visual Basic >> opening a workbookI am attempting to learn Visual Basic using Objects for a small practical
problem in which I am converting the layout of data in one spreadsheet
into a new layout in a new spreadsheet.
My development environment is VBA in excel 2000
My current problem is in opening an existing workbook and then being
able to reference it later on in my code.
i have only been able to open the file using
workbooks.open "myfilename"
i wanted to do something like the code below (which never worked):
dim wrkbk_Name as excel.workbooks
set wrkbk_Name = application.workbooks.add
wrkbk_Name.open "myfilename"
this way i could then reference a specific workbook from among
two that I have opened (the workbook with the original spreadsheet layout
and a new one with the new spreadsheet layout)
i did notice that workbooks(2) did contain the workbook with the original
data but i could not seem to reference it with a workbook name.
- 3
- Visual Basic >> 3d box for Beginner?? Please HelpHi All
I am trying to make 3dbox but I don't know about 3d display in 2d plan.
I have to display according to View Distance, XY Angle, and Z Angle
I have 2 types of data
Type Point
X As Single
Y As Single
End Type
Type Box
Pt1 As Point
Pt2 As Point
Pt3 As Point
Pt4 As Point
Height As Single
End Type
I am trying to create function like this. But I don't know 3d Math
formula.So it makes me big problem.
Public Function DrawBox(DC as pictureBox, dBox As Box, ViewDist As Single,
XYAng As Single, ZAng As Single)
End Function
Is it possible to do it. If it could Please some one help me.
Amrit
- 4
- Visual Basic >> ListBox selectionI have several list boxes on a form. I want to fill the first one at run
time, and based on the user's selection from that list box, fill the second
one, and so on. If there is only one item in a list box, I want the program
to select that item automatically and move on to the next list box. How do I
get the program to do this (i.e. simulate the Click event for that list box)?
Dan
- 5
- 6
- Mcse >> Protect Your Windows Network: From Perimeter to Data ( By Steve RiHello,
Something good to all IT Pro . The book is written by Steve Riley who was in
India
last week for his seminar on "Security Briefings" .
URL to get book :
http://www.awprofessional.com/bookstore/product.asp?isbn=0321336437&rl=1
Promo code : JJSR6437
Use above promo code to get good disocunt .
The book is focused on specifically on Windows security .
Every1 must read the book . i havent bought but will buy sooner !
Regards,
--
Amey Abhyankar.
[ M.C.P. Since 2002 ; M.C.S.E. Windows 2000 ; M.C.S.A. Windows server
2003 ; M.C.S.E. Windows server 2003 ]
- 7
- VB Scripts >> Getting output from excel back to vbscript..I have a vb basic script that automates an excel spreadsheet, it opens the
spreadsheet and then runs an macro. This macro takes a long time to run and
I want to be able to output status information to the vbscript that lauched
the command.
Is there anyway to do this? is there any kind of stdout stream that my macro
can write to that I can read in my script? I'm looking for a clean and
"correct" solution. I don't want to write to a file in the macro and then
read the file in my script.
Basically when my user runs the script the screen should read something like
this:
c:\cscript thescript.vbs
The script has been started!
Opening excel...
Starting the excel macro... <-wscript.echo in script
10 rows processed <- This would come from the macro, somehow
100 rows processed <- from the macro
Macro complete. <-wscript.echo in script
Script complete.
c:\
Is this possible?
- 8
- Visual Basic [VB] >> Copying from one db into anotherHi
I am trying to copy data from one db into another. Thanks for everyone who
suggested ways to do that. After some more research I have come up with the
below simple looking way. My question in, is it supposed to work this way
and will it work?
LocalConn.Open()
Dim DBCommand As New System.Data.OleDb.OleDbCommand("SELECT id, name, date
INTO (localtable) FROM remotetable IN [Data Source=<ip address>;Initial
Catalog="RemoteDB";Persist Security Info=True;User
ID="username";Password=password];", LocalConn)
DBCommand.ExecuteNonQuery()
LocalConn.Close()
The remote db is a sql server.
Many Thanks
Regards
- 9
- VB Scripts >> Script to Auto Insert Images into MS FrontPage?I need a script that will examine a folder to discover all the files (jpg
images) in the folder and then create html that displays the images in my
current FrontPage web page . I can then move the images around on the page
and then save the page which will place the images in the web's images
folder.
If I do it manually using Insert/Picture etc then I get html which looks
like:
<p><img border="0" src="../../Data/LEASURE/Places/Newbury/DSC01160.JPG"
width="480" height="640">
I am puzzled that the drive and highest level folder which contains the
image is not shown.
I have only a little experience of VB and none of using VBA in FrontPage (if
VBA CAN be used in FrontPage)
any thoughts?
Davy
- 10
- 11
- 12
- 13
- Visual Basic [VB] >> DatagirdView in VB.netHi
I'm working with datagrid view and I want that one line of the columens will
be with more than one cell somthing like this:
--------------------------
| a | b | c |
| | | |
--------------------------
| | | |
| | | |
| | ---------
| | | |
| | | |
| | ---------
| | | |
| | | |
--------------------------
| | | |
| | | |
| | ---------
| | | |
| | | |
| | ---------
| | | |
| | | |
--------------------------
| | | |
| | | |
| | ---------
| | | |
| | | |
| | ---------
| | | |
| | | |
--------------------------
any idea how to do it, i tried to use combobox but it didn't work well
Thanks
- 14
- VB Scripts >> How to email the @Identity value?I have an asp page that post values to a table and generates an email with
the information entered. I am not able to get the @Identity value assigned
by my page to be included within the email message. My code is below:
<%
Function ParseBody (strText)
strText = Replace(strText, Chr(13), ",br.")
ParseBody - strText
End Function
<%
Dim objConn
Dim mySQL
Dim objRS1
Dim objRS2
Dim strSQL
Dim strName
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
StrSQL = " SELECT TOP 1 * FROM Referrals ORDER BY RefNum DESC "
objConn.Open "Driver=SQL
Server;Server=cb-sql;Database=<database>;UID=<ID>;PWD=<pw>;"
mySQL= mySQL & "SET NOCOUNT ON INSERT INTO ReferralMaster "
mySQL= mySQL & "(Submitted,
Employee,Region,Branch,LOAlias,Customer,Street,CSZ,Phone1,Phone2,BestTime,Email,Purpose,Comments)"
mySQL= mySQL & "VALUES ('" & Request.Form("Submitted")& "','" & _
Request.Form("Employee")& "','" & _
Request.Form("combo0")& "','" & _
Request.Form("combo1") & "','" & _
Request.Form("combo2") & "','" & _
Request.Form("Customer") & "','" & _
Request.Form("Street") & "','" & _
Request.Form("CSZ") & "','" & _
Request.Form("Phone1") & "','" & _
Request.Form("Phone2") & "','" & _
Request.Form("BestTime") & "','" & _
Request.Form("Email") & "','" & _
Request.Form("Purpose") & "','" & _
Request.Form("Comments") & "')"
mySQL= mySQL & "SELECT @@IDENTITY AS RefNum SET NOCOUNT OFF"
objConn.Execute mySQL
objRS.Open strSQL, objConn
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "CB-HQ-EX02003"
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
Dim strText
strText = "You have received the following referral" & vbCrLf & vbCrLf & _
Request.Form("Customer") & Chr(13) & _
Request.Form("Street") & Chr(13) & _
Request.Form("CSZ") & Chr(13) & vbCrLf & _
"Contact Information:" & Chr(13) & vbCrLf & _
"Primary Phone: " & Request.Form("Phone1") & Chr(13) & _
"Alternate Phone: " & Request.Form("Phone2") & Chr(13) & _
"Best time to call: " & Request.Form("BestTime") & Chr(13) & _
"Email: " & Request.Form("Email") & Chr(13) & _
"Loan Purpose: " & Request.Form("Purpose") & Chr(13) & vbCrLf & _
"Comments:" & Chr(13) & _
Request.Form("Comments")& Chr(13) & vbCrLf & _
"************************************************************" & Chr(13)
& _
"Submitted: " & Request.Form("Submitted") & " by " &
Request.Form("Employee")& Chr(13) & _
"Referral #: " & vbCrLf & vbCrLf & vbCrLf & _
" * * * DO NOT RESPOND TO THIS EMAIL * * * "
With cdoMessage
Set .Configuration = cdoConfig
.From = "CapitalBankMortgage@capitalbank-nc.com"
.To = Request.Form("combo2")
.Subject = "New Mortgage Referral"
.TextBody = strText
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
I would appreciate any help.
Thanks
- 15
- Visual Basic [VB] >> Can't find this oneOkay, DataGrids.... lovely lil buggerz
I have a dataset, that has a table with 4 rows. I databound the datagrid to
this, but, here's what I would like to do.... I would like to add a
CheckBox Column as the first column of this bound datagrid, and the CheckBox
value has nothing to do with the underlying table. It's to tell me, as I
parse through the rows of the datagrid, if I need to do a perticular action.
I have searched for 5 hours and really have come up to a loss....
Thanks
Sueffel
|
| Author |
Message |
Fati

|
Posted: Sat Oct 21 13:41:43 CDT 2006 |
Top |
MFC >> How to filter lower case characters in an edit control?
Hi to all,
I created a class that enherits from CEdit and overrode its OnChar() message
handler to intercept the entered keys and filter only those that are lower
case. It also verifies if an entered key is upper case to convert it to lower
case and filter it.
Everything works good except the conversion from upper to lower case. The
problem is that even if the OnChar() handler does convert the character to
lower case, the character is still displayed in the edit box as it was
entered, i.e. in upper case.
Please note that if I remove the line: "nChar = tolower(nChar);", the upper
case characters will be rejected and this is not what I want. I want the same
behaviour than the edit control's Lowercase property, which will convert all
characters to lowercase as they are typed into the edit box. However, this
property allows all other character types to be output.
Here's the code of the OnChar() message handler:
#define BACK_SPACE 8
void CEditLoCase::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
TRACE("OnChar(): %c ; %d\n", nChar, nFlags);
// Filter all the characters in 'm_pFilter' to be processed.
nChar = tolower(nChar);
if ((nChar >= 'a' && nChar <= 'z') ||
nChar == BACK_SPACE)
{
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
else
{
MessageBeep(MB_OK);
}
}
I appreciate any help and thank you in advance.
Geo
Visual Studio176
|
| |
|
| |
 |
David

|
Posted: Sat Oct 21 13:41:43 CDT 2006 |
Top |
MFC >> How to filter lower case characters in an edit control?
>I created a class that enherits from CEdit and overrode its OnChar() message
>handler to intercept the entered keys and filter only those that are lower
>case. It also verifies if an entered key is upper case to convert it to lower
>case and filter it.
Geo,
Why not just create the control with the ES_LOWERCASE style?
Dave
|
| |
|
| |
 |
Norbert

|
Posted: Sun Oct 22 04:22:00 CDT 2006 |
Top |
MFC >> How to filter lower case characters in an edit control?
Geo schrieb:
> void CEditLoCase::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
> {
[...]
> CEdit::OnChar(nChar, nRepCnt, nFlags);
To "hook" into the default behaviour of a Non-MFC windows control, you need
"Window"-subclassing instead of "C++ MFC" subclassing. If you step into the
CEdit::OnChar function above with your debugger, you will notice that the
handler will probably do nothing (I have not checked), at least it will not
forward the message to the windows edit control.
Have a look at CWnd::SubclassWindow.
Norbert
|
| |
|
| |
 |
Joseph

|
Posted: Sun Oct 22 11:42:44 CDT 2006 |
Top |
MFC >> How to filter lower case characters in an edit control?
This problem arises because Microsoft totally screwed up the MFC implementation on day 1.
You can't change ANY of the parameters that are coming in; the superclass call simply
takes the incoming parameters and reuses them, instead of doing something intelligent,
such as using your parameters! (That paragraph at the end of every MFC call is there
because I collarred the MFC guys at an MVP conference and told them they had to fix MFC to
be right. They didn't, but they at least notified us that every call is screwed up.
Apparently they never *actually* understood object-oriented programming and subclassing,
and kludged up something that sort-of-worked most of the time.)
However, as already pointed out, using the ES_LOWERCASE flag will solve your problem, so
your approach is needlessly complicated. You don't even need subclassing to implement it,
just a ModifyStyle call (ES_LOWERCASE and ES_UPPERCASE are two style bits that can be
freely modified after the control is created)
joe
On Sat, 21 Oct 2006 06:10:02 -0700, Geo <EMail@HideDomain.com> wrote:
>Hi to all,
>
>I created a class that enherits from CEdit and overrode its OnChar() message
>handler to intercept the entered keys and filter only those that are lower
>case. It also verifies if an entered key is upper case to convert it to lower
>case and filter it.
>
>Everything works good except the conversion from upper to lower case. The
>problem is that even if the OnChar() handler does convert the character to
>lower case, the character is still displayed in the edit box as it was
>entered, i.e. in upper case.
>
>Please note that if I remove the line: "nChar = tolower(nChar);", the upper
>case characters will be rejected and this is not what I want. I want the same
>behaviour than the edit control's Lowercase property, which will convert all
>characters to lowercase as they are typed into the edit box. However, this
>property allows all other character types to be output.
>
>Here's the code of the OnChar() message handler:
>
>#define BACK_SPACE 8
****
Why 8? Why not _T('\b')?
****
>
>void CEditLoCase::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
>{
> TRACE("OnChar(): %c ; %d\n", nChar, nFlags);
>
> // Filter all the characters in 'm_pFilter' to be processed.
> nChar = tolower(nChar);
> if ((nChar >= 'a' && nChar <= 'z') ||
> nChar == BACK_SPACE)
> {
> CEdit::OnChar(nChar, nRepCnt, nFlags);
****
This ignores your change to nChar and simply reuses the original nChar value, which it has
hidden away!
****
> }
> else
> {
> MessageBeep(MB_OK);
> }
>}
>
>
>I appreciate any help and thank you in advance.
>
>Geo
Joseph M. Newcomer [MVP]
email: EMail@HideDomain.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio ‹ MFC |
- Next
- 1
- VB Scripts >> Using onmouseover on Image Map of the USA<Table><TR>
<! Wyoming ->
<TD><area shape="polygon" coords="119, 68, 111, 111, 132,
115, 168, 119, 173, 77, 146, 73, 119, 68" a
href="NPAGEA.asp?STCODE=WY">
<Style="CURSOR: hand; BackGround-Color:Yellow"
onmouseover="this.style.backgroundColor='Red'"
onmouseout="this.style.backgroundColor='Green'"></TD></TR>
</Table>
I am trying to write a Geography Test for students. I am
using the above code to try to change the color of the
State they position their mouse. It goes to the page on
the question I have for that State of the Union, but I
cannot get the color to change inside the polygon on the
image map. Does anyone know what I am doing wrong or if
it can be done?
Thank You in Advance
Tony
- 2
- Visual Basic [VB] >> me.controlsme.fraDate.Top = Me.Controls("fra" & Me.cboDate.Text).Top
The top line is from vb6 how can I do the same thing in
vb.net?
fraDate is a panal
me.cbodate is a combo box with a value of 1 - 6 in it.
I also have 6 panals named fra1, fra2, fra3, etc.
Thanks for the help!
- 3
- MFC >> Does MSHTML handle script?When a web page contains script codes like JavaScript or VBScript, IE
can view the page correctly as long as you don't make configurations to
disallow it.
I am wondering where does IE handles these scripts. Something out of IE
like WSH, or something inside IE? Can I do that in MSHTML?
If a page contains a piece of script that draws an image at a certain
location, can MSHTML understand that?
I mean, in the HTML DOM tree, there is only a script element;
or, there are two elements - the script element and the image element?
Thank you.
- 4
- Visual Basic >> Getting Pictures from Image list into PictureBoxI have a control array with 37 picture boxes and an image list loaded with
jpg picture.
How do I load the pictures from the image list into the picture boxes -
everything I have tried fails.
I intend to use a random number for the index so each time they load the
pictures will be in a different sequence.
any help appreciated
Gary
- 5
- MFC >> MFC and number of times COM intializedGreetings,
I was told that COM should be intialized only once in application or
once per thread. I was reading SDK samples and it says:
"CoInitialize could be called more than once in an application. The
first successful call will return NOERROR; subsequent successful calls
will return S_FALSE. Each successful nested call to CoInitialize must
be matched with a corresponding call to CoUninitialize. CoUninitialize
frees resources the COM libraries have allocated and unloads the
libraries themselves. "
I have a working MFC based application which intializes COM only once
and it works great. So my conclusion is that it can be done multiple
times too. That is, both approaches are correct. Please, if someone
can verify that if both approaches are correct. Thanks.
- 6
- Mcse >> Exchange 2000 - move existing server to new hardwareI need to move our exchange 2000 server to a new hardware
and need some advice.
In Microsoft Knowledge Base Article - 297289 - a method
is described where the the computer account is reset so
that the network name can be reused with the new
hardware - Has anyone done that before?
I seems to me that will be safer and easier to a add
second exchange server to my environment and then after
all mailboxes and folders have been moved/replicated I
can just demote the first/old server...
appreciate all comments of professionals who have been
down that road before
thanks
- 7
- Visual Basic [VB] >> button to get a directoryHi,
I have a textbox where users can enter a directory which the program then
uses. How can I add a button to let the users select a directory and the
selected directory be placed in the textbox? (I know how to add a button,
but I don't know the code for this).
Thanks
Joris De Groote
- 8
- Visual Basic >> COMM and IVB6SP6
Someone please point me to where I can find some sample code or
enlightenment to do Serial COMM without the MSCOMM1 component (using APIs
etc.).
Would like the ONCOMM event type capability rather than polling.
- 9
- MFC >> strange ShellExecute behaviourHi all
In all my MFC (and normal win32) programs ShellExecute has stopped working
and now returns SE_ERR_DDEFAIL .
I'm sure that the code used to work eg. (ShellExecute(GetSafeHwnd(), "open",
"http://www.abc.com", NULL, NULL, SW_SHOWNORMAL);)
Inter explorer is registrered to open http
ShellExecute(GetSafeHwnd(), "open", "c:\\abe.doc", NULL, NULL,
SW_SHOWNORMAL);
also fails, MS Word is associated with doc
However ShellExecute(GetSafeHwnd(), "open", "c:\\abc.mp3", NULL, NULL,
SW_SHOWNORMAL);
works, Winamp is Associated with mp3
Cheers
Peter Stausholm
- 10
- 11
- Visual Basic >> Finding the group for a userI am using VS2005 and can find a users name by using the
System.Environment.Username code. With this, I know there should be a way to
find out what group this user is a member of.
My program will process one function if the user is a member of windows
group named GROUP1 and if the user using my program is a member of GROUP2 it
performs a different function.
How can I easily check if a specific user using the program is a member of
GROUP1?
Any help is appreciated
--
Lost in the Vast Sea of .NET
- 12
- Visual Studio C++ >> Icon, Version 2. Programmation!Well, now I have a bigger job. Yay.
My manager wants me to change "manually", as in from code, the lil topleft-y
icon. For example, the app gets called with the option "m30w", and the
toplefty icon is a cat. If the app is called with the option "w00f", it
displays a dog.
See my drift? Can someone POINT ME to resources for that? I'm still in
learning phase.
Thanks in advance.
- 13
- VB Scripts >> SQL constraint rule probelmHi there,
I'm having a hard time automatically editing some users to my SQL DB.
I established it is because the surname of the people I am adding
contains an " ' ", eg surname = O'Connel
What I am sending SQL looks like:
sQLUpdateString = "UPDATE Users SET " & updateString & _
" WHERE (UserName='" & userName & "')"
conWrite.Execute(sQLUpdateString)
My script generates updateString automatically and in the case where
it updates the users full name;
updateString = FullName='John O'Connel'
In this case userName = "JohnO"
This normally works fine, (I can update all the other users in my DB
this way), however in cases like this where the surname includes the "
' " the full name in read in as being "John O" then an error because
the "Connel" part still remains and is invalid SQL. I am told that I
should probably use a rule or a constraint to fix this, however SQL is
not really my strong suit, so any pointers on how to go about this
would be greatly appreciated.
Thanks in advance
- 14
- Visual Studio C++ >> WinInet-FtpGetFile errors 12003 and 12030(Note, this happens under both Windows XP (VC++6.0) or WinCE 4.2 (eVC++4.0
SP3), which is why I'm posting this question under both newsgroups).
I'm using FtpGetFile() repeatedly to copy a folder structure that contains
222 files (total 27Mb), of which one file is 17Mb and the rest are smaller.
The 17Mb file is one of the first (#8) to copy, and it does OK, but after
14-80 files are copied (around 18-19 Mb) I get error code 12003 from the
first file that fails, then 12030 from subsequent files. Codes in the 12000
range are not included in my message list in either environment, so I don't
know what this error means. Questions:
1. What do error codes 12003 and 12030 mean? (I can't find them in MSDN or
CE Help). What is actually failing here?
2. Is there any way to get the WinInet error messages (I've seen other Ftp
routines report 12xxx error codes) included in my XP and CE environments?
I thought maybe this was a limitation of our FTP site, but our IT group says
they can copy Gbs of data with no problem.
I tried skipping over the 17Mb file, and the other 221 files (10Mb) copy
just fine.
Then, even more mysterious, I tried copying the 17Mb file last (after the
other 221), and that works fine as well!
Any ideas? Can I depend on the workaround of copying the biggest file last
always working?
Thanks,
Michael Schwab
- 15
- Visual Basic [VB] >> Crystal Report: Format Horizontal AlignmentHello,
Is there a way to format the data when it is passed into the Crystal
Report(CR).. for example.. In the original table, a number may be
left aligned, how to change it to right alignment?.. in other words I
want to change it's Format: Horizontal Alignment
from Left To Right if the
data passed in is an Integer, Currency, or
DateTime.
thanx
|
|
|