Click here to Skip to main content
15,906,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dim arr1 As String

VB
If Left(arr1(i), Len(n) + 2) = n& ": " Then

titleBar = String$(100, Convert.ToChar(0))

valid1 = Right(arr1(1), Len(arr1(1)) - 13)


how to convert vb6 to vb.net ?
Left<br />
String$<br />
Right


VB
Private Declare Function ObjectFromLresult Lib "oleacc" (ByVal lResult As Long, ByVal riid As Guid, ByVal wParam As Long, ByVal ppvObject As any) As Long 


ppvObject As any?
Posted
Updated 30-Dec-15 9:16am
v2

The Long type in VB6 is Interger in VB.NET, not Long.

A 32-bt in VB6 is a 32-bit signed integer. In VB.NET, it's a 64-bit signed integer.
 
Share this answer
 
Try ppvObject As Object
 
Share this answer
 
Comments
[no name] 30-Dec-15 6:08am    
did not work showed a null error

Private Function IEDOMFromhWnd(ByVal hwnd As Long) As HtmlDocument
Dim IID_IHTMLDocument As Guid
Dim lRes As Long 'if = 0 isn't inet window.
Dim lMsg As Long
Dim hr As Long

'---END-DECLARES---------
lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT") 'Register Wnd Message
Call SendMessageTimeout(hwnd, lMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes) 'Get's Object

'---CHECKS-FOR-WINDOW----
hr = ObjectFromLresult(lRes, IID_IHTMLDocument, 0, IEDOMFromhWnd)
End Function
Hi;

Use [object].SubString for Left:
C#
string myString = "12345";
string one = myString.Substring(0, 1);//one returns "1"


String$ repeats a string a specified number of times - it is a padding function:
C#
string UserName = new String((Char)55, 33);


The code snippet creates a new string that repeats "7" 33 times.

To replace Right, use [object].Substring, but start at the last position

string right = "123456";
string six = right.Substring(right.Length -1,1);

Remember that VB used 1 based indexers - so all arrays and counts start at 1 and not at 0.

As Any is a tricky one - you could use object, but the official docs all recommend that you trace the calling functions any specify the type explicitly, in C# we have overloading which VB did not, that may be one of the reasons for the as Any signature.

See these links:


[VB String Functions]


[MSDN]
 
Share this answer
 
Instead of left, I use Strings.Left(variable,start,len)
Instead of Right, I use Strings.Right(variable,len)

for
titleBar = String$(100, Convert.ToChar(0))

use

titleBar = Strings.Dupstr(100, Strings.Chr(0))

for
ppvObject As any

use

ppvObject As obj
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900