473,578 Members | 3,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please convert to VB.NET

Please convert to VB.NET

protected override bool ProcessKeyEvent Args(ref Message m)
{

if((char)m.WPar am == '.')

m.WParam = (IntPtr)',';

return false;

}

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

Protected Overrides Function ProcessKeyEvent Args(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 ProcessKeyEvent Args(ref Message m)
{

if((char)m.WPar am == '.')

m.WParam = (IntPtr)',';

return false;

}

Thanks!
Buzz

Aug 20 '05 #2
Hi Buzz,

Please try the following VB.NET code.

Protected Overrides Function ProcessKeyEvent Args(ByRef m As Message) As
Boolean
If Convert.ToChar( m.WParam.ToInt3 2()) = "."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 ProcessKeyEvent Args(ref Message m)
{

if((char)m.WPar am == '.')

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 ProcessKeyEvent Args(ref Message m)
{

if((char)m.WPar am == '.')

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.T oInt32)
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

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

Similar topics

0
1102
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 ButtonClick(Button.Key) End Sub
4
1539
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, lintCurrentPage As Integer
10
295
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
6989
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. Can anyone help me with that? Here is the problem: vals2 = ldap_get_values(ld,e,b);
1
5597
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 .MDB file(access project).Now how this can be implemented in the equivalent .ADP(client/server architechture)project because obviously...
2
1883
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 light on the that part. Also how to implement it in the VBA code. SELECT t_activity.no_activity, IIf(="GP","Plan",...
2
3389
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) MyMoney = MyMoney - QRolls * 10
0
89552
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 (PAY_MODE,'C','Cash','D','DD','CD','CASH/DD','Q','Chq','R','Card')), TOT_AMT,DEPT_SHORT_DESC,TRAN_STATUS,NVL(USER_CHARGES,0),shift_code, ...
0
7847
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7778
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8125
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7874
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8148
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6522
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3781
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3798
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.