473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Please convert to VB.NET

Please convert to VB.NET

protected override bool ProcessKeyEventArgs(ref Message m)
{

if((char)m.WParam == '.')

m.WParam = (IntPtr)',';

return false;

}

Thanks!
Buzz
Aug 19 '05 #1
10 2457
Our Instant VB C# to VB converter produces the following (download the demo
edition at www.instantvb.com)

Protected Overrides Function ProcessKeyEventArgs(ByRef m As Message) As
Boolean

If CChar(m.WParam) = "."c Then
m.WParam = CType(","c, IntPtr)
End If

Return False

End Function

--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#
"Buzz" wrote:
Please convert to VB.NET

protected override bool ProcessKeyEventArgs(ref Message m)
{

if((char)m.WParam == '.')

m.WParam = (IntPtr)',';

return false;

}

Thanks!
Buzz

Aug 20 '05 #2
Hi Buzz,

Please try the following VB.NET code.

Protected Overrides Function ProcessKeyEventArgs(ByRef m As Message) As
Boolean
If Convert.ToChar(m.WParam.ToInt32()) = "."c Then
m.WParam = New IntPtr(Convert.ToInt32(","c))
Return False
End If
End Function

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Aug 20 '05 #3
David,

Which is in my opinion very nice real VB.Net code

:-)

Cor
Aug 20 '05 #4
By the way, if this isn't just an adhoc sample, you might want to review what
it's supposed to do - it always returns false for instance. Also, there's no
need for the parameter to be 'ref'.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#
"Buzz" wrote:
Please convert to VB.NET

protected override bool ProcessKeyEventArgs(ref Message m)
{

if((char)m.WParam == '.')

m.WParam = (IntPtr)',';

return false;

}

Thanks!
Buzz

Aug 20 '05 #5
Hi David,

Kevin Yu's VB.NET example worked. I was unable to get your example working.

Thanks,
Buzz

"David Anton" wrote:
By the way, if this isn't just an adhoc sample, you might want to review what
it's supposed to do - it always returns false for instance. Also, there's no
need for the parameter to be 'ref'.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#
"Buzz" wrote:
Please convert to VB.NET

protected override bool ProcessKeyEventArgs(ref Message m)
{

if((char)m.WParam == '.')

m.WParam = (IntPtr)',';

return false;

}

Thanks!
Buzz

Aug 22 '05 #6
Buzz,
Kevin Yu's VB.NET example worked. I was unable to get your example
working.


I can oversee something however looking at David's code is it the same as
from Kevin (who uses only the basic framework), while in Buzz code are some
more optimized VBNet methods used.

Probably I oversee something however when not than it can be interesting and
therefore: Can you give us the error you got with Buzz his code?

Cor
Aug 22 '05 #7
If CChar(m.WParam) = "." Then 'Value of type 'System.IntPtr' cannot be
converted to 'Char'.
m.WParam = CType(",", IntPtr) 'Value of type 'String' cannot be
converted to 'System.IntPtr'.
End If
"Cor Ligthert [MVP]" wrote:
Buzz,
Kevin Yu's VB.NET example worked. I was unable to get your example
working.


I can oversee something however looking at David's code is it the same as
from Kevin (who uses only the basic framework), while in Buzz code are some
more optimized VBNet methods used.

Probably I oversee something however when not than it can be interesting and
therefore: Can you give us the error you got with Buzz his code?

Cor

Aug 22 '05 #8
Thanks for the bug report Buzz. We're looking into it now - it appears that
the intrinsic VB cast methods do not cut it (compared to C# casting) in many
cases.
Within the next day we'll have a new build that results in conversions
making more use of the Convert class methods.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#
"Buzz" wrote:
If CChar(m.WParam) = "." Then 'Value of type 'System.IntPtr' cannot be
converted to 'Char'.
m.WParam = CType(",", IntPtr) 'Value of type 'String' cannot be
converted to 'System.IntPtr'.
End If
"Cor Ligthert [MVP]" wrote:
Buzz,
Kevin Yu's VB.NET example worked. I was unable to get your example
working.


I can oversee something however looking at David's code is it the same as
from Kevin (who uses only the basic framework), while in Buzz code are some
more optimized VBNet methods used.

Probably I oversee something however when not than it can be interesting and
therefore: Can you give us the error you got with Buzz his code?

Cor

Aug 22 '05 #9
Buzz,

Thanks for showing it.

It would be in the shortest code

ChrW(m.WParam.ToInt32)
and
New IntPtr(Asc(","))

Before you misunderstand me, there is nothing wrong with the code from
Kevin. I have now learned again from this.

Thanks

Cor
Aug 22 '05 #10
Thanks Cor - we've modified Instant VB to include this correction (and the
VB-ish style of using AscW and ChrW) for casts of InPtr's to characters and
characters to IntPtr's. (Download the demo at www.instantvb.com if you're
interested in trying it out).
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#
"Cor Ligthert [MVP]" wrote:
Buzz,

Thanks for showing it.

It would be in the shortest code

ChrW(m.WParam.ToInt32)
and
New IntPtr(Asc(","))

Before you misunderstand me, there is nothing wrong with the code from
Kevin. I have now learned again from this.

Thanks

Cor

Aug 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JoseTA | last post by:
Anybody Could please help this... MDIParent Form: ------------------- Event ButtonClick(strKey As String) Private Sub tbrMain_ButtonClick(ByVal Button _ As MSComctlLib.Button) RaiseEvent...
4
by: Karunakararao | last post by:
Hi all Please Convert the VB.Net to C# .NET Sub CustomPager(ByVal STCPagerGrid As Object) Dim intCtr As Integer Static intLastItem As Integer Static intCount As Integer Static intTotalPage,...
10
by: Buzz | last post by:
Please convert to VB.NET protected override bool ProcessKeyEventArgs(ref Message m) { if((char)m.WParam == '.') m.WParam = (IntPtr)','; return false;
3
by: Todd_Goselin | last post by:
Hello, I've got a problem that I can't fix by myself, I'm fairly new to programming in C and in Unix and so I'm having a tough time doing a simple task of converting a binary number to a string....
1
by: shovan mohanty | last post by:
Hi , Can anybody convert below access query into equivalent stored procedure. Also please advice in the below query,user defined function of VBA i.e anneeSelection41510() has been used in the...
2
by: rahuldev999 | last post by:
Hi Can anyone please convert the below access query to the equivalent stored procedure.No problem with the IIF() function but the condition in the "where" clause making problem.so please put some...
2
by: royjm18 | last post by:
Dim MyMoney As Single Dim DRolls As Integer Dim NRolls As Integer Dim PRolls As Integer Dim QRolls As Integer Dim RemainingChange As Single MyMoney = 28.24 QRolls = Int(MyMoney / 10)...
0
by: phani kumar NSR | last post by:
i have a query which is in oracle pls convert and give me in postgresql format. SELECT MST.TW_TRAN_NO ,NVL(DEPT_RCPT_NO,'--'),CONSUMER_NO,NVL(CONSUMER_NAME,'---'), UPPER( DECODE...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.