Advertisement

02.27.2008 at 10:07AM PST, ID: 23197818
[x]
Attachment Details

Help converting vb6 to vb.net 2008

Asked by Dixon8402 in Visual Studio 2008, .NET, Microsoft Programming

Tags: vb6, vb.net, vb

Below is the a section of a program that I am trying to covert to vb.net 2008 from vb6 I believe. I am a c# developer and not to great in visual basic.
On the third line from the bottom I am getting the following error:

Error      6      'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is not a delegate type.      

Can anyone help me?
Thanks in advanceStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
Function EnumWinProc(ByVal hwnd As Integer, ByVal lParam As Integer) As Integer
		Dim k As Integer
		Dim sName As String
		
		If GetParent(hwnd) = 0 Then
			
			'If IsWindowVisible(hwnd) And GetParent(hwnd) = 0 Then
			sName = Space(128)
			k = GetWindowText(hwnd, sName, 128)
			If k > 0 Then
				sName = Left(sName, k)
				If lParam = 0 Then sName = UCase(sName)
				
				If Trim(sName) = Trim(sPattern) Then
					hFind = hwnd
					EnumWinProc = 0
					Exit Function
				End If
			End If
		End If
		EnumWinProc = 1
	End Function
	
	Public Function FindWindowWild(ByRef sWild As String, Optional ByRef bMatchCase As Boolean = True) As Integer
		sPattern = sWild
		If Not bMatchCase Then sPattern = UCase(sPattern)
		
		'UPGRADE_WARNING: Add a delegate for AddressOf EnumWinProc Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
		EnumWindows(AddressOf EnumWinProc, bMatchCase)
		FindWindowWild = hFind
	End Function
[+][-]02.27.2008 at 12:46PM PST, ID: 20998212

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio 2008, .NET, Microsoft Programming
Tags: vb6, vb.net, vb
Sign Up Now!
Solution Provided By: TheLearnedOne
Participating Experts: 2
Solution Grade: B
 
 
[+][-]02.27.2008 at 07:24PM PST, ID: 21000979

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628