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...
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...
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...
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...
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...
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 ...
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...
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
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...
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...
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,...
.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...
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.
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...
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...
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....
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,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...
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....
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); ...
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...
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...
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.
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...
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"...
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...
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 ...
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 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 ...
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...
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...
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,...
'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...
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 =...
.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...
Use the Split function. Dim output() As String output = Split("Cat Dog", " ") Would produce Item( 0 ): Cat Item( 1 ): Dog ...
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...
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...
You can use: Public\s+Const\s+g(?<Name>[a-zA-Z][a-zA-Z0-9]*)\s+=\s+(?<Value>False|True) demo ...
you don't close the recordset and the connection... you delete rs.close and cn.close
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...
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.
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...
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(); ...
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...
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...
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....
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...
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...
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...
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...
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.
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...
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.
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...
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...
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...
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...
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:...
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...
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...
Maybe decompiling is what you're looking for. Take a look at this threat: Is there a vb6 decompiler?...
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...
Change dbCmdDelJUUCHUUMESAI.Parameters(0) = pIX TO dbCmdDelJUUCHUUMESAI.Parameters.Append dbCmdDelJUUCHUUMESAI.CreateParameter("a name for parameter", parameter_data_type, adParamInput,Size,pIX) ...
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...
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...
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...
I fixed this issue by changing the last argument in CryptAcquireContext (0) to the CRYPT_VERIFYCONTEXT flag. Seems to be working fine now!
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,...
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...
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,...
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...
oracle,vb6,database-connection,oracle11gr2
You should install and configure Oracle Client. SQL Developer uses JDBC and seems to have a native driver.
10 digits, starting 7,8,9 isValid = TextBox11.Text like "[789]#########" if (not isValid) then msgbox "Invalid" ... ...
Use Screen.Width Screen.Height object.Top object.Left to move the object out of the screen area...
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 */ } ...
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....
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...
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...
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,...
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...
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...
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...
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...
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....
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...
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))...
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...
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...
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...
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) ...