Menu
  • HOME
  • TAGS

How to preview a VB6 .frm file?

vb6

As you say, you can view .frm and .vbp files in a text editor. These include most of the information about the from. As far as I know however the only way to actually view and edit the forms is with the Visual Basic 6 IDE. I'm not entirley sure...

VB6 Handle error raising in error handler

error-handling,vb6

You'd rather use RESUME than GOTO in the error handler section: On Error GoTo ErrorHandler maxretry=3 c=1/0 Again: c=a/b ErrorHandler: if maxretry>0 then maxretry=maxretry-1 Resume Again end if Using RESUME will, sort of, reset the internal error handler flag and giving you re-entrance in it (sort of). Resume Again tells...

Compare items in an Array to items in a Variant in VB6

arrays,vba,vb6,variant

This really isn't a Variant problem, it's just a looping/control variable issue. Even though you have your DIM statement inside your main loop, VB does not treat that as a "redeclaration" and reset/reinitialize its value before your UNTIL loop. As a result, 'i' will increment to 1 and then retain...

Is Visual Basic a very useful Programming Language nowadays? [closed]

visual-studio,vb6

VB has many different versions and I would say not to bother learning VB6 but VB.Net would be good if you want to stay with VB (though I prefer C#). Just like any programing language the older it is the less a particular version gets used. I have a worked...

Format of a VBP File reference line

reference,vb6,vbp

The UUID is the typelib ID, the 1.0 is the typelib version number. The third part, a "0" here, is the LCID. This is commonly 0 (unless a localized build of the library has been referenced). After that comes the file that contains the type information, and last comes descriptive...

How to call .dll coded in vb6 from AutoHotkey Script?

vb6,autohotkey

I found solution that AutoHotKey can dll in which classes are defined like Vb6 and C# as follows obj:=CreateObject("projectName.ClassName"); // using CLSID obj.FunctionName(Parameters); Thanks all ...

How To I Write Copymem Lib “Kernel32” Alias “Rtlmovememory” In Vb.Net

vb.net,visual-studio-2010,vb6,copymemory

If you want to access data using pointers in .NET then you need to keep them pinned during the whole operation. The VarPtr method pins the object while getting the address to it, but then it unpins the object. That means that the object can be moved while you are...

COM Class on a destination machine

c#,.net,com,vb6

i put the installer inside a .net setup project and added the dependencies and it works now. However when i add the .tlb and the .dll gets added the .dll needs to make sure it is changed to vsdrfCOM in register property

Seeing functions available when referencing a COM library (created in VS2013) in VB6

interface,com,vb6,class-library

Dim comObj As Object You are using late binding by using CreateObject(). The VB6 IDE has no idea what kind of object might be created at runtime and what its members look like. So it cannot display any IntelliSense info. Use early binding instead, the common choice in a...

How can I navigate to the next or previous procedure?

vb.net,visual-studio-2010,vb6

Yes, keybindings do exist and you're in luck; the keybindings below relate to Visual Studio 2010's Visual Basic. It's come to my attention that these default keybindings aren't available in some installations of Visual Studio. If this is the case for you then proceed with the key-binding instructions below this...

Invoking a RESTFul WebService using WinHttp

web-services,rest,http,vb6,winhttp

Here's the solution : Sub SendAsynchMessage() Dim objHTTP As New WinHttp.WinHttpRequest Dim doc As New MSXML2.DOMDocument Dim root As MSXML2.IXMLDOMNode Dim success As Boolean Dim str As String On Error GoTo ErrorHandler success = doc.Load(App.Path & "\flow.xml") Set root = doc.selectSingleNode("/root") str = CStr(root.childNodes.Item(0).xml) URL = "http://ipAddress:8081/messageAsynch" objHTTP.Open "POST", url,...

Why do I have to register COM DLLs using regasm?

vb.net,dll,vb6

.NET doesn't make COM dlls. It simulates COM. When you register a .NET COM DLL it registers the core .NET DLL (MSCORE.DLL) that handles and translates COM calls and passes on to the .NET DLL. If regasm only being able to do per machine installs is the problem with the...

VB.net Forms UI display issue in some laptop

vb.net,vb6,vb.net-2010

Okay, After some research, we found that the display settings for those users were set to 125% and because of that there were UI issues. I changed the display settings back to 100% and Booom it works just fine. Thank you all for you help.

CGZip.dll referenced but objects of class still undefined

dll,vb6,visual-studio-2005

made comment to answer - Ok, then my assumptions were wrong. Next Question: Are you working with VB6 or VB.NET. VB6 ist strict 32bit, while VB.NET allows 32 and 64 bit. And then you have to register the correct OCX. When you are on 64 bit Windows, and you...

What is happening in this code

vb6

Your edit still makes not enough sense - unless the code was SendMessageStr List1.hwnd, &H18D, &H20, "directory*.*" and you thought the space means it's a stand-alone bit (it isn't). That code is SendMessage (List1.hwnd, LB_DIR, DDL_ARCHIVE, "directory*.*") - it sends a documented Windows message to a ListBox control named List1...

VB & Chinese string

unicode,vb6,utf-16

VB6 is ANSI when calling API calls as WIN95 didn't support unicode. In COM and internally it's Unicode. Therefore any API call, as the clipboard requires, your TEXT will be converted to ANSI. Therefore don't use TEXT. XMLHTTP has several formats to choose from. Internet Explorer can access the clipboard....

How to solve code conversion issue?

vb.net,vb6

You should change: Public Function SaveCommentsTreeComments(ByRef f As System.Windows.Forms.Form) As Integer To: Public Function SaveCommentsTreeComments(f As YourFormClassName) As Integer This changes two things, first f will now be of the right type and have a CommentsText property, field or function. Secondly, when passing parameters the default for VB6 is ByRef,...

VB6 - How do I open a file from an app running as a service

vb6,windows-services,shellexecute,createprocess,shellexecuteex

You cannot simply call Shellexecute() in the context of a process running as a service. Even if it succeeds (never really tested it), the launched app/document still wouldn't show on the desktop of the logged-on user because those are two different sessions, isolated from each other (unless you're on Windows...

Is there a variable type which can refer to a control (type may differ) in vb6?

vb6,controls

Using the "Object" Datatype worked. I needed to set it equal to the control using a Set statement SET mCombo = ssOLEDBCombo I am more familiar with vb.net/c# where this Set keyword isnt necessary....

How to convert vb6 'vbFromUnicode' to string in C#

c#,.net,vb6

This is a conversion of a Unicode string to an Ansi string, by system default code page. StrConv(strTemp , vbFromUnicode) In C#, you need to found out the default code page by ANSICodePage from current culture int codepage = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage; byte[] convertedBytes = Encoding.GetEncoding(codepage).GetBytes(unicodeString); string convertedAsciiString = System.Text.Encoding.ASCII.GetString(convertedBytes); ...

Set vb6 form to instance of a hardcoded form

vb6

The best solution for this is using what Bob77 said and applying it to the form. When loading Form1 using the Forms.Add("Form1") method if you were to implement Set Form1 = Me in Form_Load it will now set the reference of Me to be Form1 so that when you made...

What would be the role of a Java designer script project in a VB6 to C# conversion?

c#,vb.net,vb6,computer-science

You are correct in saying that *.designer.cs files are usually created by the IDE. However, generating them yourself makes sense here. To understand why, you have to realize what that file actually is. The IDE takes all the stuff you do on the actual forms designer (hence, designer.cs) and stuffs...

Code difference between the two times

time,vb6

You need to use the DateDiff function. You also want to be storing values in variables declared using dim variableName as Date, not text boxes. You'll also want to sanitize the input somehow, so that your program doesn't crash the first time someone enters "bob" as a time.

Prevent Compile Errors from Non-Compiled VB6 File

visual-studio-2012,vb6

Visual Studio has no support for VB6 code. By using the .bas file type, you are telling Visual Studio that these are VB.NET files which, for some reason, you do not want to compile. I don't see any way to get the best of both worlds here. Perhaps someone has...

How to determine a path is a file or directory in vb6?

vb6

Check if the original string is a valid string too. Function FileOrFolder(strg As String) Dim fs, FExists, DirExists Set fs = CreateObject("Scripting.FileSystemObject") FExists = fs.FileExists(strg) DirExists = fs.folderexists(strg) If FExists = True Then FileOrFolder = "It's a file" '// file ElseIf DirExists = True Then FileOrFolder = "It's a folder"...

What is the proper usage of RpcMgmtEnableIdleCleanup in managed code?

vb.net,vb6,destructor,vb6-migration

Looks like voodoo programming. One imagines you do this at the beginning of a program not the end. It can only be turned on not off. It may be on or off as the system determines. The system will turn it on when necessary. I'd say this is nothing to...

How to get selected rows in vb6 TDBgrid

vb6

As you said you have changed to dbgrid then you can do below Dim row As GridViewRow = GridView1.SelectedRow Dim CellValue = row.Cells(1).Text ...

Negate a specific group in regular expressions

regex,vb6

You can use the regex in a negative look-ahead and then add a \w shorthand class to match alphanumeric symbols, or [a-zA-Z] with \b word boundaries: (?![0-9-+*/()x]|abs|pow|ln|pi|e|a?(?:sin|cos|tan)h?)\b[a-zA-Z]+\b See regex demo Since we are only allowing letters with [a-zA-Z], we can reduce this further to (?!x|abs|pow|ln|pi|e|a?(?:sin|cos|tan)h?)\b[a-zA-Z]+\b See another demo...

How to reset color properties of Microsoft Heirarchical FlexGrid?

vb6,mshflexgrid

How about this? Private Declare Function GetSysColor Lib "user32" ( _ ByVal nIndex As Long) As Long Private Function BgrColor(ByVal Color As Long) As Long If Color >= 0 Then BgrColor = Color Else BgrColor = GetSysColor(Color And &HFFFFFF) End If End Function ...

How to get a random letter in VB6?

string,random,vb6,letters,alphabet

You can turn an integer code point into a character with the Chr() function, and go back the other way with Asc(). That means you can get a random letter with code such as: Dim mych As String mych = Chr(Asc("A") + 26 * Rnd) ...

Converting 32x32 StdPicture icons to PNG

arrays,vb6,png

You can use a property bag like this Option Explicit Private Sub Form_Load() Dim encoded As String encoded = EncodeImageToBase64(LoadPicture("d:\temp\aaa.gif")) Caption = "Encoded Size: " & Len(encoded) Set Picture = DecodeImageFromBase64(encoded) End Sub Private Function EncodeImageToBase64(ByRef Image As StdPicture) As String Dim oBag As PropertyBag Set oBag = New PropertyBag...

How do I find what a TextBox's contents will be after pressing Ctrl + Z, before it occurs?

textbox,vb6,keypress,undo

I have worked with textbox APIs a bit ..And i don't think you can deal with its UNDO buffer due to its limitation.. but something you can do is to manually send an UNDO then read the textbox content. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As...

Masking textbox to accept only 1 digit after decimal

textbox,vb6,masking

Put the code below in change event of textbox. I think "." point is used for decimal seperator. if "," coma is used, then change the point in the code with coma. Private Sub TextBox1_Change() Dim strA As String Dim intP As Integer strA = TextBox1.Text intP = InStr(1, strA,...

application.worksheet.function that Count the number of cells in columns greater than another

excel,vba,excel-vba,vb6

'First variant '======================================================================== Sub test() Dim N As Long, LastRow As Long, ocell As Range N = 0 LastRow = Cells(Rows.Count, 5).End(xlUp).Row For Each ocell In ActiveSheet.Range("E1:E" & LastRow) If ocell.Value >= ocell.Offset(, 1).Value And _ ocell.Value > 0 And ocell.Offset(, 1).Value > 0 Then N = N + 1...

How to simulate C# char.IsLetter in VB6

vb6

Option Explicit Private Declare Function IsCharAlphaW Lib "user32" (ByVal cChar As Integer) As Long Private Declare Function IsCharAlphaNumericW Lib "user32" (ByVal cChar As Integer) As Long Public Property Get IsAlpha(character As String) As Boolean IsAlpha = IsCharAlphaW(AscW(character)) End Property Public Property Get IsAlphaNumeric(character As String) As Boolean IsAlphaNumeric =...

ADO.NET Entity Framework In A COM Visible VB.NET Class Library

.net,vb.net,entity-framework,com,vb6

VB6 is likely to be using ADO while VB.NET/C# would be using ADO.NET. They are two different data access technologies and there are going to be differences in their connectionstring formats. If you really need/want to connect to the database from the VB6 COM code you'll need an additional connection...

Split string by a space

string,vb6

Use the Split function. Dim output() As String output = Split("Cat Dog", " ") Would produce Item( 0 ): Cat Item( 1 ): Dog ...

How to give file path to “save as” window using vb6

vb6

The problem is that you aren't waiting for the SendKeys text to be processed by the target application. A call to DoEvents is not the same thing as waiting for an external application to do something. It allows your application to flush the rest of its event queue. If you...

Missing responseText Information (vb6 call)

json,vb6,responsetext,serverxmlhttp

It was a limitation of the vb6 debugger itself. It was not displaying the full response even though it was in fact there if I outputted to a message box or file. Using MSXML2.ServerXMLHTTP to access data from a web page returns truncated data in Lua helped draw this conclusion...

Regular Expression for whole world

regex,c#-4.0,vb6

You can use: Public\s+Const\s+g(?<Name>[a-zA-Z][a-zA-Z0-9]*)\s+=\s+(?<Value>False|True) demo ...

Excel Data to Data Grid View in vb6

excel,vb6

you don't close the recordset and the connection... you delete rs.close and cn.close

Convert 10009335357561071 to hex string

vb6

I was able to code it myself. Because of the vb6 limitations of the size of a number, I had to go about it in different ways. I needed this to be able to covert VERY LARGE WHOLE numbers to Binary and Hexadecimal. This this code, there are three functions...

WinHTTPRequest Automation Error (2147024769)

dll,vb6,winhttprequest

See Using WinHTTP as a Side-by-side Assembly if you need to use WinHttp 5.1 on Win2003 Server SP1 or later. A sample manifest can be found there but to make use of the information you'll need an understanding of manifest use in VB6 applications.

RegSetValueEx returns “Access is denied”, even though regedit allows the same user to edit this value

winapi,vb6,registry,windows-security

Since Vista was released in 2005, access to HKEY_LOCAL_MACHINE is restricted by UAC. Your user may well be an administrator, but unless the process is started with elevated rights (which RegEdit is), UAC will prevent write access. In order to write to HKEY_LOCAL_MACHINE you will need to ensure that the...

VB6 code explanation

vb.net,vb6

The InStr finds the (one-based) index of a string in another string. The closest equivalent in the modern .Net string methods is .IndexOf. However, I would replace the code you have with this C# statement. string sRetStr = (sString.Where((c) => char.IsDigit(c)).ToArray()).ToString(); ...

VB 6.0 - Formating Textbox “dd/MM/yy”

vb6

you can chose which keys you allow in the textbox. for example as follows: '1 form with: ' 1 textbox : name=Text1 Option Explicit Private Sub Text1_KeyPress(KeyAscii As Integer) ' Caption = CStr(KeyAscii) KeyAscii = DateOnly(KeyAscii) End Sub Private Function DateOnly(intKey As Integer) As Integer Dim intResult As Integer intResult...

VB 6 Advanced Find Method in View Code

vb6,find

You need to use what are known as "wildcard" characters. In the find window, you'll notice there is a check box called "Use Pattern Matching". If you check this, then you can use some special characters to expand your search. ? is a wildcard that indicates any character can take...

Memory consumption by two dimensional array of strings and msflexgrid

string,memory,vb6,msflexgrid

All windows in VB are ANSI (8 bit). VB is Unicode (16 bit) internally. You can save your strings as a byte array. Byte arrays can contain ANSI or Unicode....

Switching from ODBC to OLEDB and getting “Object Required”

vba,vb6,odbc,oledb

From you code ReturnData is not being created or anything, unless you are declaring it to be global variable else where. I imagine you are doing this in Excel. In which case replace ReturnData.Range("A1").CopyFromRecordset tableRecords(10) with something like activeworkbook.sheets("Sheet1").Range("A1").CopyFromRecordset tableRecords(10) EDIT. Managed to replicate it and then fixed it. Try...

Multi-res Icon use in VB6

windows,forms,button,vb6,icons

I have found that the best approach is to only have one icon image per icon file. If you expect the icon to show as a 16x16 then provide a .ico file with a 16x16 icon in (say) 8-bit colour. That way VB has to use the icon you provide....

Find and Find Next for RichTextBox

vb6,richtextbox

According to the MSDN Article: If the text searched for is found, the Find method highlights the specified text and returns the index of the first character highlighted. If the specified text is not found, the Find method returns 1. I'm assuming it's a typo and the return is -1...

VB6 get filename from path

csv,path,vb6,filenames

Function GetFileNameFromPath(strFullPath As String) As String GetFileNameFromPath = Right(strFullPath, Len(strFullPath) - InStrRev(strFullPath, "\")) End Function However, your problem is caused by either you not using FreeFile or not closing the file and it is locked. Public Function SomeMethod() On Error GoTo errSomeMethod Dim lngFileHandle As Long lngFileHandle = FreeFile Open...

Multilevel Combo box in vb6

vba,vb6

This looks like a Popup menu that was bounded to the ComboBox click event This link demonstrates how to create a popup menu programmatically And If you're working with VB6, just hit CTR+E, and follow these instructions After configuring the Popup menu, all you're left to do is: Private Sub...

Team Foundation 2012 not recognising changes in vb6 app

visual-studio-2012,tfs,vb6,tfs2012

If you don't want to specifically check-out files (or use an editor that does it for you like VS), then you should switch to using a local workspace. In source control explorer dropdown the workspaces dialog and change the settings from Server -> Local.

socket opening on WIndows 2012 extremely slow

sockets,vb6,windows2012

I ended up finding the answer to this after some extensive digging. Starting in Windows Server 2012, Microsoft has enabled an extension of TCP called Explicit Congestion Notification (ECN). This allows end-to-end notification of network congestion with the loss of packets. The way this is enabled on a TCP packet...

Why do I get an error 0x80029C4A (TYPE_E_CANTLOADLIBRARY) on anything other than my dev box?

c#,.net,vb6,com-interop

I worked this one out I think... Foolish me was trying to use the DLL in a background thread and even though it was an STA thread it wasn't my friend.

Exposing a Collection to a VB6 app through COM Interop

vb.net,com,vb6,com-interop

No, the Microsoft.VisualBasic.Collection class is not <ComVisible(True)>. Any of the .NET 1.x interfaces and collection classes in System.Collections are good. The COM way is to only expose interfaces, so use IEnumerable if the VB6 code should not modify the collection, IList if it does. So you want to write it...

Storing matrices in an array in visual basic 6

arrays,matrix,vb6

Dim m As Variant ReDim m(1 To 2) Dim ar1() As Long, ar2() As Long ReDim ar1(1 To 2, 1 To 2) ReDim ar2(1 To 2, 1 To 2) m(1) = ar1 m(2) = ar2 'Accessing m(1)(1,2) = 42 Note that this copies ar1 and ar2 into m, not puts...

If Statement Contains Only “True”

c#,if-statement,vb6

Most likely this is the result of a condition that was removed in the past. I.e. there used to be a condition in the if, but not any longer. You should check the source control history for changes to that line. You can just remove the whole if statement in...

Reading VB6 three-dimensional array in FreePascal/Lazarus

arrays,multidimensional-array,vb6,lazarus,fpc

It clears out that I used damaged data for my research. And I had bad dimension sizes. And I wasn't clear about the dimension order in my algorithms. Only the array data is saved to the file, coding the first dimension at the first place, then the second, and so...

ActiveX dll not working on IIS 8.5

iis,vbscript,asp-classic,vb6,activex

The problem was caused by using the incorrect handler mapping. I had it setup as a Script Map. It needed to be a Module Mapping with the following details: Request path: *.dll Executable: Path to the jpwheel.dll Module: IsapiModule Name: jpwheel Request Restrictions: All Verbs, Access required: Script Feature Permissions:...

Why is Server not receiving multipart/form-data post data

vb6,multipartform-data,winhttprequest

It turns out that if you don't specify the Charset in the content-Type header it automatically assigns UTF-8 at the end of the header. This results in the posted message not working! Solution manually enter the Charset before the boundary. Now it works fine.....tough error to find when you keep...

Can't get an error in VB6 on Windows 7 while I can on Windows Xp

windows-7,vb6,windows-xp

I find the solution. I have to use "Clear" to explicitly clear the Err object after treatment of an error, and then when I want to close the "selection folder box" the program close it correctly on Windows XP and on Windows 7. So if you use On Error GoTo...

Can I open an installed application in visual studio for debugging?

vb.net,vb6

Maybe decompiling is what you're looking for. Take a look at this threat: Is there a vb6 decompiler?...

GetWindowsDirectory() API returns wrong (vba\vb6)

vba,winapi,vb6

The behavior you are observing is documented. See the Remarks section for GetWindowsDirectory: Terminal Services: If the application is running in a Terminal Services environment, each user has a private Windows directory. There is also a shared Windows directory for the system. If the application is Terminal-Services-aware (has the IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE...

Error SQL Command Vb6: Syntax error or access violation

mysql,sql,vb6,multi-query

Change dbCmdDelJUUCHUUMESAI.Parameters(0) = pIX TO dbCmdDelJUUCHUUMESAI.Parameters.Append dbCmdDelJUUCHUUMESAI.CreateParameter("a name for parameter", parameter_data_type, adParamInput,Size,pIX) ...

When VB6 application will end?

windows,vb6,32-bit

The "2024" means as part of Windows 8. The link says the VB6 runtime is part of Windows and therefore will be supported in the same way as the rest of Windows. For example Windows 8 will be supported until 2024 because that's the support lifecycle for Windows 8. Microsoft...

Change parameters On error in vb6

vba,vb6

Don't use errors to control the flow of the logic, instead look at all the available names and select the one you want: Function GetBestMatchingSheet() As Worksheet For Each GetBestMatchingSheet In ActiveWorkbook.Sheets Select Case LCase$(GetBestMatchingSheet.Name) Case "typical sheet name", "secondary sheet name", "third name" Exit Function End Select Set GetBestMatchingSheet...

How to modify this VBA code for VB

vba,vb6

VB uses VBA as it's language. So no conversion needed. VB is an app object and forms package that hosts VBA, like Word is a Word Processor that hosts VBA. In your code you don't connect to Word. In Word, some objects are made automatically available. Outside of Word you...

CryptAcquireContext() fails with return code 0x8009000B NTE_BAD_KEY_STATE - But user password has not changed

winapi,encryption,vb6,handle

I fixed this issue by changing the last argument in CryptAcquireContext (0) to the CRYPT_VERIFYCONTEXT flag. Seems to be working fine now!

How to decode UTF8 in VB6?

utf-8,vb6

Here's what I've done. Use the MultiByteToWide Char like Comintern said to: Private Const CP_UTF8 As Long = 65001 ' UTF-8 Code Page 'Sys call to convert multiple byte chars to a char Private Declare Function MultiByteToWideChar Lib "KERNEL32" ( _ ByVal CodePage As Long, _ ByVal dwFlags As Long,...

How to create an array with textboxes in Visual Basic 6.0

arrays,vb6,controls

Your code isn't compiling because it is vb.net code. It should go without saying (but I'll say it anyway) that vb6 and vb.net are not the same thing. If you want to use an array, you will have to dimension the array with a number that is one less than...

If statement not working in vb6

winapi,vb6

Your Mid() statement is wrong. The third parameter needs to be length - 1 instead of length + 1 to strip off the null terminator: title = Mid(title, 1, length - 1) Since you are not stripping the null terminator, your title variable does not actually contain "Personalization" by itself,...

VB5 Project on Jenkins Slave: Build errors

jenkins,vb6,master-slave

Turns out that this was an error on my part. I was reading the contents of the .VBP project file and replacing the version number using a java program. I was using the wrong line endings when I wrote the content back to the project file and this was causing...

vb6 can not connect oracle 11g r2 with ADO but can connect with SQL Developer

oracle,vb6,database-connection,oracle11gr2

You should install and configure Oracle Client. SQL Developer uses JDBC and seems to have a native driver.

I want to give validation for mobile number in vb6

validation,vb6

10 digits, starting 7,8,9 isValid = TextBox11.Text like "[789]#########" if (not isValid) then msgbox "Invalid" ... ...

How to hide the object of the OLE controler?

vb6,media-player,ole,visible

Use Screen.Width Screen.Height object.Top object.Left to move the object out of the screen area...

C# Com Interop class methods are not visible in VB6?

c#,.net,dll,vb6

Discussion in comments lead to the following, the ProgId attribute was not set. [ClassInterface(ClassInterfaceType.None)] [Guid("3884D59D-AB76-41E7-82B6-21C66DBDCBF3")] [ComVisible(true)] [ProgId("VNDBUtils.VNSqlFormatter")] public class VNSqlFormatter : IVNSqlFormatter { /* implementation information */ } ...

Change DataGrid cell value in VB6

datagrid,vb6

The technology (VB6) is indeed very old; you can try something like Sub AddSymbol() For i = 1 To DataGrid1.Rows If DataGrid1.Item(i, 2) = 1 Then DataGrid1.Item(i, 2) = "*" Next i End Sub where quantity is stored in the second column of DataGrid1 control. Hope this may help....

Variable Declaration issue in vb6

arrays,vb6

You made an understandable error, one I have been caught with myself. When declaring variables the comma starts a completely new declaration. So dim ar(10),i,a as integer is the same as dim ar(10) dim i dim a as integer Which as you can see declares 'ar' as an array of...

Need code for removing all unicode characters in vb6

unicode,vb6,unicode-string

If this is UTF-16 text (as normal VB6 String values all are) and you can ignore the issue of surrogate pairs, then this is fairly quick and reasonably concise: Private Sub DeleteNonAscii(ByRef Text As String) Dim I As Long Dim J As Long Dim Char As String I = 1...

VB6 Initialize event called AFTER Terminate event for user controls

vb6

Debug.Print means your running this in debug mode in the IDE. When debugging you would see a Terminate when the form unloads, you then see the reinitialisation of the User Control as its re-loaded in the Form in the Form Designer for editing. This won't happen from a compiled EXE,...

How to correctly use On Error Goto for different HRESULT values

c++,vb6

COM specifies which values in a HRESULT are treated as errors, and which aren't. To quote from Structure of COM Error Codes: The high-order bit in the HRESULT or SCODE indicates whether the return value represents success or failure. If set to 0, SEVERITY_SUCCESS, the value indicates success. If set...

SQL query to return maximum values from multiple columns

sql-server,vb6

SELECT Customers.CustID, CustName, MaxInvoiceTotal, MaxDiscount FROM Customers INNER JOIN Interesting ON Customers.CustID = Interesting.CustID INNER JOIN (SELECT CustID, MAX(Discount) AS MaxDiscount FROM Orders Group by CustID) MaxDiscountOrders ON Customers.CustID = MaxDiscountOrders.CustID INNER JOIN (SELECT CustID, MAX(InvoiceTotal) AS MaxInvoiceTotal FROM Orders Group by CustID) MaxInvoiceTotalOrders ON Customers.CustID = MaxInvoiceTotalOrders.CustID WHERE CustID...

ASC Visual Basic for Java

java,vb6,ascii,non-ascii-chars

First of all, note that ISO 8859-1 != Windows Latin-1. (See http://en.wikipedia.org/wiki/Windows-1252) The problem is that Java encodes characters as UTF16, so casting to int will generally result in the Unicode value of the char. To get the Latin-1 encoding of a char, first convert it to a Latin-1 encoded...

Dtpicker in VB6

visual-studio,vb6

Use format function (same you did for DatePicker) when assigning value to your label : Private Sub Command1_Click() Label34.Caption = Format(DTPicker1.Value, "yyyy/MM/dd") End Sub Or even better, get format from DatePicker: Private Sub Command1_Click() Label34.Caption = Format(DTPicker1.Value, DTPicker1.CustomFormat) End Sub I don't remember, but maybe DatePicker has a property giving...

FileSystemObject calls executing… too fast?

vb6

I suspect your problem is that shell returns immediately after starting (or failing to start) the process. I would suggest using the API call CreateProcess and waiting for at least a little bit for the process to return a result. I use this enough I've created a method for this....

Running SQL Files with Variety of DDL commands and INSERT operations from a VB6 Code

sql,sql-server,sql-server-2008,vb6,ado

You can run SQL scripts from the command line using sqlcmd -S myServer\instanceName -i C:\myScript.sql (see https://msdn.microsoft.com/en-us/library/ms170572.aspx) In VB6 you can execute command line strings using the Shell command, for example to start the Windows Calculator: Shell "C:\WINDOWS\System32\calc.exe", vbNormalFocus For more on the Shell command see: https://msdn.microsoft.com/en-us/library/aa242087.aspx and How do...

Error calling dateadd function

function,windows-7,vb6,dateadd

The following code works without any problems with VB6 on my Windows7 64bit machine: Option Explicit Private Sub Command1_Click() Dim datNow As Date Dim datYesterday As Date datNow = Now datYesterday = DateAdd("d", -1, datNow) Print "Yesterday = " & CStr(datYesterday) End Sub Private Sub Form_Load() MsgBox (DateAdd("d", -1, Now))...

Is using variants in vba bad for performance?

vba,variables,vb6

It depends. Variants are slower then native types, but in most programs, it doesn't matter at all. Most macros are small and get compiled when run and the diference may be a few microseconds, that you can't perceive. Variants have their advantages, I love them. So it depends on what...

Exclusive OR (XOR) in vb6 versus c#

c#,vb6,xor

A long in vb6 is a 32 bit signed value, so its range is - 2,147,483,468 to 2,147,483,468. A long in C# is a 64 bit signed value, so its range is –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. In the vb6 XOR you are overflowing, thus why the number is negative. To get...

how to populate an array using anither?

arrays,vb6

Try the following example project: Option Explicit Private Sub Form_Click() Dim intIndex As Integer Dim intSrc(10) As Integer Dim intResult() As Integer 'fill source array with some etxt values For intIndex = 0 To UBound(intSrc) intSrc(intIndex) = intIndex * intIndex Next intIndex 'fill resulting array with subset 3 to 7...

Load control from array of controls

vb6

Ok, I actually made it myself! To access the object array itself I just need to change Set TmpCtrl = ObjectsArray(x) into Set TmpCtrl = Me.Controls(ObjectsArray(x).Name) ...