Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

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

I have Windows 10 and need my old 32-bit VB6 projects to run and compile on this. I have read some articles saying that tweaks and tricks has to be done and I need someone that did this before, to help me, remote control my Win10 and install VB6 for me. Anyone?

I've read these:
http://blog.danbrust.net/2015/09/14/installing-visual-basic-studio-6-on-windows-10/
https://www.fortypoundhead.com/showcontent.asp?artid=23993
https://kngvct.wordpress.com/2017/03/22/a-simple-guide-to-installing-microsoft-visual-basic-6-in-windows-10/
0
On Demand Webinar: Networking for the Cloud Era
LVL 10
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Hi Experts,

Wondering if there is a way to prevent user from selecting all records in a continuous form and copying into memory?
PS, I can remove the copy/paste menus, however they can still use Cntrl+C to have that contents copied into memory

Thanks in advance.
0
This may be an obvious question to many, but I've tried multiple iterations and much internet searching and can't get this to work.  I basically want to ask the user to input a value and then use that value in a table with filters to filter the data using the input word.  Would appreciate any help.  My current attempt below.

Thanks

Dim newVal

newVal = InputBox("Enter the search term")

If newVal = "" Then Exit Sub

Sheets("Question Database").Select
    ActiveSheet.ListObjects("RFPQs").Range.AutoFilter Field:=1, Criteria1:= _
        " & newVal & ", Operator:=xlAnd

Open in new window

0
this is my code and am sending get request using proxy how ever when i click the button the iu freezez please help.
is their a faster way without the ui freezing up ,  its only when proxy is used in winhttp it freeze  please help

RichTextBox1.Text = ""
Dim lngI As Long
For lngI = 0 To List1.ListCount - 1
If Combo1.ListIndex = Combo1.ListCount - 1 Then
        Combo1.ListIndex = 0
        
    Else
        Combo1.ListIndex = Combo1.ListIndex + 1
        Text2.Text = Combo1.Text
    End If
'       Text1.Text = ""
   Dim result As String
Dim url As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
url = "http://example.com"
winHttpReq.Open "GET", url, False
'winHttpReq.SetRequestHeader "User-Agent", "SonyEricssonT618/R401 Profile/MIDP-1.0 Configuration/CLDC-1.0"
winHttpReq.SetRequestHeader "User-Agent", Text2.Text
winHttpReq.SetRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
winHttpReq.SetRequestHeader "Accept-Language", "en-US,en;q=0.8,en-us;q=0.5,en;q=0.3"
'winHttpReq.SetRequestHeader "Accept-Encoding", "gzip,deflate"
winHttpReq.SetRequestHeader "Accept-Charset", "windows-1251,utf-8;q=0.7,*;q=0.7"
winHttpReq.SetRequestHeader "Keep-Alive", "115"
winHttpReq.SetRequestHeader "Connection", "keep-alive"
winHttpReq.SetProxy 2, List1.List(lngI), ""
winHttpReq.Send
'result = winHttpReq.ResponseText
   'RichTextBox1.Text = RichTextBox1.Text & winHttpReq.Status & vbCrLf & 

Open in new window

0
I need to return a single character from a text string following "<Gender>", how can I do that? Thank you
0
Access 2013 and ASP Classic
New to Access, I have the database and an excel file on my server in the same folder.  I created a query that links to the excel sheet.  I then have a web page that allows users to sort / filter / search for products on the query, which is linked to the excel sheet.  It appears if I open the excel, it locks others from using the webpage.  You can see the webpage with the error I included in the title.  It was my understanding, that while I work on the excel sheet, it created a locked file for me, so that the webpage could still function?  The folder that has the database, is read/write permissions for a group of users. (100).
Here is my connection strings:
dim rsFieldOneObject
dim connectionStringToAccess
Set rsFieldOneObject = Server.CreateObject("ADODB.Recordset") 
Set connectionStringToAccess = Server.CreateObject ("ADODB.Connection")
connectionStringToAccess.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & server.mappath("db/matrix-1.accdb")       	

Open in new window

This is where it first tries to pull data:
                 dim objRs
		Set objRs = Server.CreateObject("ADODB.Recordset")
		dim sicSQL
		sicSQL= "Select distinct(SIC), SIC_Description from MaxtixTable2"
		objRs.Open sicSQL, connectionStringToAccess
		Response.Write "<select name='sicInput' required>"
		response.write " <option value='' selected> SIC Choice... </option>"

Open in new window

Then it loops thru the data to create a drop down of choices.

I am using the linked excel so a team of four can keep it updated with no experience in ... anything computers.
I hope to create a form for them to use in the future, but deadline for project is too close to do that right now.

Do I have to tell them not to do any updates to excel during normal operation hours?  or should the excel being opened create a locked version so that the users can still use the webpage?

Thanks
0
Hello,

I have devlopped a "library" (heavily object oriented) contained in an access database (let's call it IM), intended to be used (referenced) by other projects (wich users can install wherever they want).
For many reasons, I make an extensive use of late binding, cept on the IM database itself.
I tryed setting a reference dynamically, that turned out to be a nightmare to manage (reference broken, name already used and so on ...)

Is it possible to late bind on the IM database ?
Or are there any better solution ?

Client code will need to either instanciate classes or use utility fonctions from IM database.
I saw about using the application.run function, but it only work for procedures, and return no value, wich isn't my need.

Thanks for your replies.
0
Thanks in advance...
0
I have a code sequence that scrolls through my outlook contacts and updates all that have been edited or added since the last update was run

It doe this by saving the last uodate and only editing contacts that have a creation date or a lost modification date after the saved date.

The process takes some time (6,000 + contacts)

Is there a way to "filter" the contacts folder and only scroll through those that have a creation date or a lost modification date after the saved date
0
Option Explicit

Private Type DOCINFO
  pDocName As String
  pOutputFile As String
  pDatatype As String
End Type

Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long) As Long
Private Declare Function EndDocPrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long) As Long
Private Declare Function EndPagePrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long) As Long
Private Declare Function OpenPrinter Lib "winspool.drv" Alias _
    "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
    ByVal pDefault As Long) As Long
Private Declare Function StartDocPrinter Lib "winspool.drv" Alias _
    "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, _
    pDocInfo As DOCINFO) As Long
Private Declare Function StartPagePrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long) As Long
Private Declare Function WritePrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, _
    pcWritten As Long) As Long
Private Declare Function AbortPrinter Lib "winspool.drv" (ByVal _
    hPrinter As Long) As Long

Private Sub Command1_Click()
    Dim lhPrinter As Long
    Dim lReturn As Long
    Dim lpcWritten As Long
    Dim lDoc As Long
    Dim sWrittenData As String
    Dim MyDocInfo As DOCINFO
    
    Dim intBarcode As String
    intBarcode = "12345"
    
    lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)  ' \\192.168.1.38\Argox

    If lReturn = 0 Then
        MsgBox "The Printer Name 

Open in new window

0
New feature and membership benefit!
LVL 10
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Items:

Two Computer with each program with textbox

PC1:
I have project with Textbox and Button

PC2:
Also have project with textbox only

Problem:
How can I send the text in the textbox from PC1 to PC2?

Any help please, Thanks
0
How can I connect SQL to my Form (datagridview1)

I am new here in VB.net I don't have any idea but I am willing to learn, I do coding in VB but not using SQL and I only use text file for my database (txt, dll, bat)

this is my prev. project here and they helped me a lot, now I am trying to connect SQL, please help and TIA

Listview and Datagridview answered question here in Expert Exchange - this is my prev post

Details:

SQL Connection
:IP Address 192.168.6.252
SQLMy Table
Table
Datagridview1:
DGV
0
Hi Experts,

I have a code that should be changing the SQL of a pass-through query, and I realized suddenly that each time the code executes, new tables are being created in my app..

See attached.

Below is the code.

Private Sub ComboFindByRef_Change()
    Dim qd As QueryDef, s As String
    On Error Resume Next
    If Me.ActiveControl.Name = "ComboFindByRef" Then
        s = ComboFindByRef.Text
    Else
        s = ComboFindByRef.Column(1)
    End If
    Set qd = CurrentDb.QueryDefs("EmployeesSearchPTQry")
    'qd.sql = "select * from [dbo].[EmployeestblSelectBy" & "Ref" & "PH] ('" & Me.ComboFindByRef.Text & "','" & Nz(ComboFindByRefField, "ContactPerson") & "')"
    qd.sql = "exec [dbo].[PH_EmployeestblSelectByRef] '" & s & "','" & Nz(ComboFindByRefField, "ContactPerson") & "'"
   qd.Connect = "ODBC;driver={SQL Server};server=...;"

    Me.ComboFindByRef.RowSource = "EmployeesSearchPTQry"
    
    SendKeys "{F4}"
End Sub

Open in new window


Any idea whats going on??!

Thanks in advance
Untitled.png
Untitled1.png
0
Hi.

I need your help on a macro.

I have an MSHFlexgrid1 that i need to populate based on 3 different criteria.

No1: Start date
No2 How many Weeks
No3: Days requested

Let's take below picture as an example:
I have the start date of : 28-08-2017
I also have the number of week set to 10
And i also have the "Tuesday" day checked
grid_sample
What i would expect to see in the MSHFlexgrid1 is to add 10 rows where i would see the following 10 Tuesday dates starting on the Starting date of 28-08-2017 .

That would be:
29-08-2017
05-09-2017
12-09-2017
13-09-2017
19-09-2017
26-09-2017
03-10-2017
10-10-2017
17-10-2017
24-10-2017

I could check multiple different days also. Based on the days i check, it would add the the dates in the MSHFlexgrid1 in to LaneStartDateTime column.

How can i do that?

Thank you for your help.
date_conversion.zip
0
This is the code, how to convert this? Thank you

private void button1_Click(object sender, EventArgs e)
{
/* Clear the list view items */
listView1.Clear();

// Stream on to the textfile
var sr = new StreamReader("data.txt");

//create an object list type of string to store your data later
List<string> l = new List<string>();

//variable to hold the data from the textfile
string data = "";

//loop through the data line by line
while ((data = sr.ReadLine()) != null)
{
// since it is comma separated split it with comma and check if it is equal to your textbox value
if (data.Split(',')[2].Trim().Equals(textBox1.Text))
{
// if found store the data to list 

//date
l.Add(data.Split(',')[0]);

//name
l.Add(data.Split(',')[1]);

//unique id
l.Add(data.Split(',')[2]);
// break the loop since you found it already no need for the loop to continue
break;
}
}
//dont forget to close the streamreader
sr.close();

//create a listview item object and pass the data to the list view
var item = new ListViewItem(l.ElementAt(0));
item.SubItems.Add(l.ElementAt(1));
item.SubItems.Add(l.ElementAt(2));
listView1.Items.Add(item);

}

Open in new window

0
Hi experts, I'm having difficulties in connecting database with sql 8 to a network or other pc. Codes below is working locally but when i try to run it via network an error occur,  says; " Server does not exist" . Im using OS Widows 10. Thanks!

Sub eMiles(edate, db As String, rmrk As String)
        Dim e As Save_Files
        Set e = New Save_Files
        e.OPEN_CON db, "SkyJob" & "\SQLEXPRESS"
            e.RecordHistory edate, rmrk
        e.CLOSE_CON
end sub

Open in new window


Public Sub OPEN_CON(db As String, ServerName As String)
Set cn = New ADODB.Connection
cn.Provider = "sqloledb"
cn.ConnectionTimeout = 12
cn.Properties("Data source").Value = Trim(ServerName)
cn.Properties("Initial Catalog").Value = Trim(db)
cn.Properties("User ID").Value = "sa"
cn.Properties("Password").Value = "100"
cn.CursorLocation = adUseClient
cn.Open , "sa", ""

If Err.Number <> 0 Then
    MsgBox (Err.Number & "|" & Err.Description)
End If

End Sub

Open in new window

0
Hi,

I would like to be able to divide a cost per any amount so that the total once divided equals the cost not divided.

Ex:
If the Cost = 357.25$
If the divided value = 3
If we do 357.25 / 3 = 119.083333333333

So i cannot say that the value would be 119.08 per value cause 119.08*3 = 357.24.
So it would have to put 119.09 on the first and 119.08 on the 2 last value for a total of 357.25.

How can i do that?

Before the division:
Before
After
After
Thanks for your help
Cost-devided.zip
0
Hello guys,

I need help with the creation of a Macro that is doing my head...

Let me try to resume so it is super clear for everyone :

SHEET 1 = A simple food plan with Name / client Code / Menu Type and Allergies (then food below). This sheet is a individual and set by client.

SHEET 2 = An order form with the list of clients (order form contains names / client code / Menu type and allergies). This sheet is a whole list of client.

WHAT I WANT = A Macro that would generate the following report

- The macro would open Sheet 3 - Copy the whole format from sheet 1 - paste it in sheet 3 - goes to sheet 2 and copy the data (into the form pasted in sheet 3 from sheet 1) with the following information -> SHEET 2 -> Copy C6 paste it in SHEET 3 cell D4. / SHEET 2 -> Copy F6 and paste it in SHEET cell A1 / SHEET 2 Copy B6 and paste in SHEET 3 cell D5 / SHEET 2 copy K6 and paste in SHEET 3 cell B1.

- When this is done it would rename SHEET 3 with the code present in SHEET 3 Cell B1.

NEXT :

- THe macro would finally repeat as many new sheet with the above process as there are clients listed in SHEET 2 (if there is 5 clients - 5 new sheets would be created, if 20 clients then 20 new sheets). Finally each new sheet would be renamed as per cell B1 in that new sheet.


Thanks a lot guys that would help A LOT.
0
I have a script that will create folders for students with individual data folders contained therein.  For example, when I run the script for folder 2025 it will create sub folders labeled for each user (IE: “Lskywalker”, “Hsolo”, etc.)  Users have access to their folder to save data.

The problem I am facing is when I run my script to create all the new users folders it gives the student user “Full” rights to the folder, which we don’t want them to have; just “Read / Write” (to prevent them from changing permissions, etc).  I can make the change on each folder manually but that is extremely time consuming. I’ve found that I can use the “cacls” command to change the permissions, but not sure how to combine this into my current script.

Any help would be greatly appreciated.
0
Concerto Cloud for Software Providers & ISVs
LVL 4
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Been using GPO preferences for shortcuts and they are working well...except for one I need to open a UNC path

Windows 2008r2 domain
Windows 10 laptops

Here's the preference setup
UNCPRINTERS.jpg
0
Hello friends I have a problem with DIGITALPERSONA ONE TOUCH READER BIOMETRIC ,I cant take and save image of finger to jpg,here is a example of my code.....

Private Sub DPFPEnrollmentControl1_OnComplete(ByVal pSerialNumber As String, ByVal lEnrolledFinger As Long)
Dim oPicture As IPictureDisp
Set oPicture = DPFPEnrollmentControl1.EnrolledFingersMask
Picture1.Picture = DPFPVerificationControl1
End Sub


really I dont know how to resoved it if anyone can help me would be a GREAT help......thank you for you time.
0
Folks I keep getting an error on this code at:
.lstCategory.ListIndex = 0

Open in new window

in the below subroutine when the workbook opens and I haven't figured out what is causing it?
Private Sub Workbook_Open()
Dim intIndex As Integer

With Worksheets("Main Menu")
    For intIndex = 10 To .UsedRange.Rows.Count
        .Cells(intIndex, 1).Value = ""
        Next
        .Activate
        .lstCategory.ListIndex = 0
End With

Open in new window

Error opening workbook
0
Hi experts, I have a problem obtaining data in sqlserver in which in my sql command I need to advance 1 day of my time end before able to obtain the data.  My data field in sql is look like this, "2017-08-17 10:00:00.000"  this means that it has a time and this is August 17, 2017. In my sql command I cannot obtain this record if i set the time end to "08/17/2017" but  "08/18/2017" meaning i need to advance 1 day. Is there anyone who can explain me why. What shall i do to make my sql command set "08/17/2017"?

Set rs = cn.Execute("Select Proname, TheDate,  from sTable where TheDate Between '" & "08/17/2017" & "' And '" & "08/17/2017") & ") 

Open in new window

0
Hi All,

Greetings....

According to my work, pdf files will be get merged in a specific path. I need to give dynamic file names to the mergedOutPut File.
1. Is there any way to pass parameters to the file name?
2.Or I can give fixed file name to the mergedOutput file through my code.After that Can I  rename it into dynamic naming conversion?

I saw RENAME command in Foxpro. But I am not sure whether I can pass parameters to it

Any help regarding this would be highly appreciated.

Thanks in Advance.
0
I'm working on a macro that inserts a style separator before the first period in every heading level 2 paragraph. It is also set up to skip any paragraph that is not heading 2. Currently it only works as many times as you specifically trigger it, but I would like it to continue looping until the last style separator is inserted in the last heading 2 paragraph. I can't figure out how to loop this without creating an infinite loop. I'm new to the macro writing game so please excuse my code:

      
 If Selection.Style = "Heading 2" Then
            Selection.MoveUntil Cset:=".", Count:=100
            Application.Run MacroName:="LWmacros.basHNum.InsertStyleSeparator"
            ActiveWindow.Selection.GoTo wdGoToHeading, wdGoToNext

ElseIf Selection.Style <> "Heading 2" Then
             ActiveWindow.Selection.GoTo wdGoToHeading, wdGoToNext

End If 

Open in new window



 I'm not sure what sort of condition I would need to set for the Do Loop for it to end after the last heading level 2 paragraph is found.
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.