Visual Basic Classic

163K

Solutions

58K

Contributors

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi ... I want to correctly add the minutes and show them in list1 every 45 minutes, I have two text boxes representing hour and minutes and a textbox that represents the minutes to show, how can I do?

Dim Cada
Dim icountHora
Dim icountMin
Dim i
List1.Clear
Cada = tturnomañanacada.Text
Dim t7
Dim t23
t7 = Comboturnomañanade.Text
t23 = Comboturnomañanahasta.Text
          For icountHora = t7 To t23 - 1
             For icountMin = 0 To 50 Step Cada
     

        List1.AddItem Format(icountHora & ":" & icountMin, "hh:mm")
         Next icountMin
       Next icountHora
0
Instantly Create Instructional Tutorials
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

VB6: I have two arrays of 8 text boxes each. The first is populated with texts. The second is all empty. I want to transfer the text from each of the first array to a different Indexed text box in the second array. (It saves a lot of typing, and possible typos.)

I tried a “drag and drop” using “mouse up” and “mouse down” events. Can’t seem to get it to work.

Dim sText as string

Source text box MouseDown event:
sText = txtBoxA(Index).text

Destination text box MouseUp event:
txtBoxB(Index).text = sText

What’s the secret here that I am missing?

Right now I am doing this using the click events. That requires the user to click, move the mouse, and click again. Drag and drop would be smoother.
0
Hello Experts,

I inherited an ASP application, that is very messy, across multiple of domains, virtual directories, etc... I'm not even able to create a test environment, so I'm making all changes live.

Anyways, here's the situation...

On MSSQL i have a fldEnabled bit set to False

In one common.asp include, I have
Session("bolNightSeason")   = (.Fields("fldEnabled"))

Open in new window


I also tried
Session("bolNightSeason")   = CBool(.Fields("fldEnabled"))

Open in new window


Then, after including common.asp in another file,, I have
bolNightSeason = Session("bolNightSeason")
Response.Write("night = " & bolNightSeason)

Open in new window


Now the issue is in the output...

  • When I first start the browser, I see
  • night=
  • ...
  • expected as i set it to False

  • Then, if i hit Refresh I see
  • night=True
  • ...
  • How is this possible, when the field value in the db is still set it to False?

  • Refreshing remains True, but closing and re-opening the browser goes  back to ""

Can any one spot why the value is changing, or advise on how I can trace the issue?

Any help will be greatly appreciated.

Thank you.
0
Hello

I am looking for help to write some code so that I have a listbox (or similar) that can enter a date into a cell.

Unfortunately my work IT department have blocked 6.0 objects, so can't use any of the pop-up calendars available, therefore, I would like a userform with 3 entry points; day number, month and year, to be selected (via dropdown or similar) and then entered into the cell in the format DD/MM/YY.

It's Friday and I'm full of cold and my brain can't take attempting the different answers that come up in google...please can someone help me!!!!!

Thanks
Amy
0
I need help with a Word Macro which will search for the word "apple" in a word document and change the font color of all the instances of the word ("apple") to green.
Thank you for your help.
0
I have an Access 2010 form (frmContributionSingleRec) that is working correctly except for two things.  When the Move Record button is clicked the record displayed on the form moves to another table as expected but then a dialogue box opens which prompts me to enter a parameter value for another form.  That other form is not open and there is no code behind the open form that makes reference to it.  The same thing happens when another button is clicked that is supposed to confirm the record has been moved.  None of the queries that run using code behind the form reference the closed form.

Something is obviously referencing the closed form but after reviewing everything connected to the open form I'm stumped. The code behind the Move Record button is shown below.

Private Sub cmdMoveRecord_Click()
    Dim strMsg As String
   
    strMsg = IIf(IsNull([Org or Project Name]), "    Organization Name" & vbCrLf, Null) & _
             IIf(IsNull([Street Address]), "    Address" & vbCrLf, Null) & _
             IIf(IsNull([City]), "    City" & vbCrLf, Null) & _
             IIf(IsNull([County]), "    County" & vbCrLf, Null) & _
             IIf(IsNull([State]), "    State" & vbCrLf, Null) & _
             IIf(IsNull([Sub Category]), "    Sub Category" & vbCrLf, Null) & _
             IIf(IsNull([Zip Code]), "    Zip Code" & vbCrLf, Null) & _
             IIf(IsNull([Loan Number]), "    Loan Number" & vbCrLf, Null) & _
             IIf(IsNull([Dollar Amount]), "    …
0
When opening Word Document files  recently  a window comes up with a title Microsoft Visual Basic, with an option to 'end' or 'debug'. What is this about? Can this be got rid of?
0
Hello.

I have a VB application that calls an external dll for address verification.  I need to add this code to a C# application but my conversion of the code is not being accepted.

VB6 code:

Declare Function UNZ_INIT_EX Lib "UNZDLL32.DLL" () As Long
Declare Function UNZ_TERM Lib "UNZDLL32.DLL" (ByVal hUnz As Long) As Long
Declare Function UNZ_CHECKADDRESS Lib "UNZDLL32.DLL" (ByVal hUnz As Long, ByVal Line1$, ByVal line2$, ByVal line3$, ByVal Line4$) As Long
Declare Sub UNZ_GETSTDADDRESS Lib "UNZDLL32.DLL" (ByVal hUnz As Long, ByVal szFirmName As String, ByVal szPRUrb As String, ByVal szDelLine As String, ByVal szLastLine As String)
Declare Sub UNZ_GETERRORTEXT Lib "UNZDLL32.DLL" (ByVal hUnz As Long, ByVal ErrorText As String)
Declare Function UNZ_GETMATCHCOUNT Lib "UNZDLL32.DLL" (ByVal hUnz As Long) As Long
Declare Sub UNZ_GETMATCHADDR Lib "UNZDLL32.DLL" (ByVal hUnz As Long, ByVal intItem As Integer, ByVal szFirmName As String, ByVal szPRUrb As String, ByVal szDelLine As String, ByVal szLastLine As String)
Declare Sub UNZ_GETAREACODE Lib "UNZDLL32.DLL" (ByVal hUnz As Long, ByVal szAreaCode As String)

C# code:

using System.Runtime.InteropServices;
[DllImport("unzdll32.dll", CharSet.Auto)]

And I started doing this:

public static extern long UNZ_INIT_EX();
public static extern long UNZ_TERM(long hUnz);

But, VS2017 doesn't like it.

Thoughts?  Thanks. :)
0
I'm working on an old vb6 windows forms application.

On a window I notice it has a grid.

When I select the grid and look at the properties of the grid, it shows that its a vaSpread control.

Anyone know the url for the API reference for vaSpread or what type of control is vaSpread?
0
I'm trying to rebuild a development environment which crashed.  I'm using VB6 on a virtual XP machine (please don't laugh!).  I've got everything back together - no errors when loading the project. When I run the project it opens a connection to the SQL server, but when it sets up to read the first table, I get an error "Method or data member not found".
Set rsSayings = New ADODB.Recordset
With rsSayings
       .CursorType = adOpenStatic        The error is on "CursorType"
       .
       . 
       .
End With

Open in new window

Now please don't go into why this code is bad, and ADODB shouldn't be used.  The code isn't the problem - I think I'm missing a reference, but I can't find which one is missing.  I have included all the references that I can think of -
Microsoft DAO 3.6 Object Lib
Microsoft Data Enfiroment
Microsoft ADO Ext. 2.8...
Mictosoft Data Access Components
Microsoft SQLDMO Object Lib.

I appreciate any help
Thanks.
0
Free Tool: Site Down Detector
LVL 9
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi experts, Is it possible to get the sum of a certain fields during Insert execution? Please see my code below where I tried to get the sum of a credit but the codes is not working. Any help please!

Public Sub SaveSalesPOS(rct, record, disc, tot, edate, cid, credit, check, cuscode)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

        cn.Execute ("Insert into CustomersLedger(CustomersCode,iDate,TransactionNumber,Credit,Debit,Balance) Values('" & cuscode & "','" & _
                    edate & "','" & record & "'," & credit & "," & "0" & "," & Sum(SalesPerTrx.credit) & " where CustomersCode='" & cuscode & "')")
        
Set rs = Nothing
End Sub

Open in new window

0
The error is component dbgrid32.ocx or one of its components is not registered correctly.
0
Hi there all..

I've three RichTextBox . I can save the three RichTextBox texts into one RTF file.

How can i read back from this file to the three  RichTextBoxs ?

THANKS...
0
I would like to set the From background colour into two equal halves,the upper one is black ,the second bottom half into blue.
0
Is there any way to have a vb6 child form show a new control array item without reloading the page?  Reloadng the page resets one variable that I would like to not be re-set.  I assume there is no way to do something like  you can in classic asp via passing a query string?
0
I created a function that will query a SQL Server 2000 database and return a value based on the contents of cell A1.  I "call" this function from cell B1.

If I copy B1 down to B2 (using A2 as the "filter") the recordset gets completely re-queried from the database.

Can I avoid this?  I'd like B2, C2, etc just to pull/filter data from a disconnected or memory resident recordset.

Thanks
0
Hi
I am trying to use following code  to get date format in "dd-mm-yyyy"

like dtpicker1.value = 06-01-2017 (mm-dd-yyyy)
using following code getting desired result like 01-06-2017 in crystal report formula

        Dim DatfrmDate As Date
        DatfrmDate = DTPicker1.Value
        DatfrmDate = Format(DatfrmDate, "dd-MM-yyyy")        
        CrystalReport1.Formulas(1) = "FromDate = '" & DatfrmDate & "'"

Same code using for Dtpicker2.value  but not getting "dd-MM-yyyy format
like dtpicker2.value = 06-30-2017 (mm-dd-yyyy) then it supposed be 30-06-2017
but no luck please help

        Dim DatToDate As Date
        DatToDate = DTPicker2.Value
        DatToDate = Format(DatToDate, "dd-MM-yyyy")        
        CrystalReport1.Formulas(2) = "ToDate = '" & DatToDate & "'"
0
Hi Experts,

I am in middle of enforcing a PWD for users who want to open our Access system, and the way its being setup is that each user have their own password.

Now I need to have a way of handling in case user forgot their PWD.

Was thinking of having a button "forgot my password", and in that case an email will be sent with their pwd.

In order to ensure no user request someone else's pwd, I would save along with their pwd the IP address of that pc, so at the time user logs into the system and clicks forgot my pwd, if the IP is not the same it will not do anything.

Just having some issues:

1- Users may realize it has to do with which pc they use.
2- Since email will be sent from the local pc they are on, it will remain there on sent items.
3- By Using SendObject it will display the contents of the email and wait for user to click send, in that case user already saw the pwd, so I have not accomplished anything by sending an email, I can for this money popup a msg box..
4- If I use the outlook programming model instead, I will have to add reference to Outlook library and this may cause some issues in our app.

What are my options?
0
Hi Experts,

I'm creating a table of users passwords and would like to ensure each password contains at least one digit, one uppercase and one lowercase letter, how do I check for that within a string?
0
Announcing the Most Valuable Experts of 2016
LVL 6
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Hello,

Note:
This is a follow-up to several other threads related to a very cool macro code created by EE Expert gowflow for Excel. The code enables automated intracellular formatting in a spreadsheet.

Please see this thread for a brief explanation and screenshot as well as to obtain the most current version of the code in the attached Excel file.

Question for this thread:

Can the current code be modified so that any number of blank and unrelated columns can be inserted in front or to the left of the Original Text column?

For example, I tried inserting a single column (column A) as shown here:

2017-07-2c19a_EE.png
But after doing so, the Formatted Text appeared in the wrong column (column L) causing it to overwrite part of String 5:

2017-07-2c19b_EE.png
It would be very helpful to be able to freely insert (and/or delete) at the very beginning (ie left of the Original Text column), not just one column, but as many columns as a user might need while working in the spreadsheet. In other words, it would be super if, as an extreme example, one could insert say, 208 columns at the beginning or far left of the spreadsheet (which would move Formatted Text to column HA) without affecting the workings or results of the code.

Is that doable (I hope)?
0
Hello,

Note:
This is a follow-up to several other threads related to a very cool VBA macro for Excel created by EE Expert gowflow. The code enables automated intracellular formatting in a spreadsheet.

With the code, a user can effect multiple and varying formatting changes to defined strings of characters within a cell containing a text entry. The process is shown in the upcoming screenshot where: 1) A text entry is placed in column A after which 2) two numeric values (defining the starting position and length of the string to be reformatted) are entered into one or more of 3) five pre-formatted "String" columns* depending on the desired Format (as displayed in row 2 of each column), and 4) clicking the green "Format" button which activates the macro and causes the reformatted text to appear in column L.

2017-07-03a_EE.png
Any of the row-2 formats can be modified using the Format Cells > Font box and numeric values can also be changed as desired with updated results immediately appearing in column L by a repeat click of the Format button.

*As shown in the above screenshot:  1 "String" column = 2 Excel columns

Question for this thread:

How can the user insert additional String columns if more than the starting five columns are desired?

Thanks

The most recent version is attached: Intracellular-formatting-V02.xlsm
0
I need help with a word Macro that would search for the word "apple" in the active document and replace all the instances of that word with the word "mango". However, before replacing each instance of "apple" it would display a message box with two options ("OK" and "No" on it) and will replace "apple" with "mango" only, if I chose OK option. If I chose "No" the macro should look for the next instanace of "apple" in my document and again display a message box (or a small user form with two buttons on it) and check from me whether I want to replace this second instance. This will happen for each instance of the "apple" in my document. Hope my question is clear.
Thank you for your help.
0
Î have a visual basic 6 application

I need to be able to play u tube file from the application
by specifying its URL

Does anybody know the syntax for accomplishing this

Thanks

O.A.  Oluwole
0
Hi Guys, within an Excel macro, I use the following code which filters Column 12 for a Range called "PrevDay" (which is a Cell which has the Previous Day's Date) but it does not work. What's wrong with the code?

Sheets("PL Star Accrual").Select


    Rows("26:26").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$26:$AZ$242").AutoFilter Field:=15, Criteria1:="0"

    ActiveSheet.Range("$A$26:$AZ$242").AutoFilter Field:=12, Criteria1:=Range("Prevday")
0
Hello,

This is another in a series of questions I have posted recently to come up with Excel VBA code that will selectively reformat a specified string (or strings) of text within a cell, but not the entire cell.

For example, suppose you wanted to reformat a sentence in cell B2 to that shown in D2:

2017-06-27a_EE.PNG
Note that the particular formats shown in this screenshot are arbitrary as the main objective is to have a code which can apply any desired formatting.

Thanks
0

Visual Basic Classic

163K

Solutions

58K

Contributors

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.