Quantcast
Channel: VBForums
Viewing all 42486 articles
Browse latest View live

CommonDialog with restrictions

$
0
0
Does anyone know of a method to make the CommonDialog dumb?

Some of my users have problems dealing with the normal CommonDialog when working with a laptop and using the Touchpad.
Somehow they manage to move folders inside folders when trying to select a single file.

I found already an older thread in which some subclassing is used to prevent the user to popup the context menu.
But I can't find anything about making the CommonDialog more restricted, prohibiting all file operations from with the CD.

I also checked the IFileDialog but this also has complete Explorer functionality.

Ndde DDEServer

$
0
0
Has anyone ever been able to use the NDDE library to get a successfully working DDE Server??

I am in need to add a DDE Server to my application to be able to receive data from another program that uses DDE. I have been unable to get a DDE Server working with NDDE and vb.net

If you have please let me know...

Rick

Hangman game import words from array

$
0
0
Hi all. I am new to programming and I am trying to create a Hangman game.
Doing some research online helped me creating a Hangman game that doesn't load words from an array. But I have no idea how to make it load from the words from an array and use them. I know code for showing the program the path to the text file, but I don't know how to make it use these words... Please help me, I have no clue.

||
Code:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
        Dim strwoord As String
        Dim objrandom As New Random
        Dim intteller As Integer
        Dim arrwoorden(3) As String
        Dim intwrongguess As Integer = 0
        Dim intRandom As Integer
        Dim blnpresent As Boolean
        Dim chrguesbo As Char
        Const cstrletters As String = "abcdefghijklmnopqrstuvwxyz"
        lblWord.Text = String.Empty
        PictureBox1.Visible = False
        lstLetters.Items.Clear()
        intRandom = objrandom.Next(1, 4)
        arrwoorden(1) = "printer"
        arrwoorden(2) = "phone"
        arrwoorden(3) = "teleportation"
        strwoord = arrwoorden(intRandom)

        Select Case intRandom
            Case Is = 1
                Me.lblHint.Text = "A device that prints"
                Me.lblWord.Text = "------"
            Case Is = 2
                Me.lblHint.Text = "A device that calls"
                Me.lblWord.Text = "-----"
            Case Is = 3
                Me.lblHint.Text = "theoretical transfer of matter or energy from one point to another without traversing the physical space between them "
                Me.lblWord.Text = "-------------"
        End Select

        strwoord.ToCharArray()
        Do
            chrguesbo = InputBox("Give a letter from a-z").ToLower
            If InStr(cstrletters, chrguesbo) = 0 Then
                MessageBox.Show("you can only use letters")
            Else
                If lstLetters.Items.Contains(chrguesbo) = False Then
                    blnpresent = False
                    lstLetters.Items.Add(chrguesbo)
                    For intteller = 0 To Integer.Parse(arrwoorden(intRandom).Length - 1) Step 1
                        If strwoord(intteller) = chrguesbo Then
                            Me.lblWord.Text = lblWord.Text.Remove(intteller, 1)
                            Me.lblWord.Text = lblWord.Text.Insert(intteller, chrguesbo)
                            blnpresent = True
                        End If

                    Next
                    If blnpresent = False Then
                        PictureBox1.Visible = True
                        PictureBox1.Image = lisHangman.Images(intwrongguess)
                        intwrongguess += 1
                    End If
                Else
                    MessageBox.Show("Letter has already been used before")

                End If
            End If
        Loop Until lblWord.Text = arrwoorden(intRandom) Or intwrongguess = 6
        If intwrongguess = 6 Then
            MessageBox.Show("You lost the game. To play again press the button. The correct word was " & arrwoorden(intRandom).ToString, "Lost")
        Else
            If lblWord.Text = arrwoorden(intRandom) Then
                MessageBox.Show("You won the game", "Won")
            End If
        End If


    End Sub
End Class

Error on DataTable.Select statement

$
0
0
Hi

I am filling some DataTables which i use for filtering (via binding source) which i then use to populate comboboxes on the form, they all work great except im getting an error on a certain filter and im not sure why.....

Here is the code the error occurs

Code:

        'change the column names that are used to more meaningful names for the combo text/value fields
        DT.Columns(14).ColumnName = "Text"  'Col FeedYardName
        DT.Columns(15).ColumnName = "Value" 'Col FYID

        'FeedYard Filter
        Dim View As New DataView

        View = DT.Select("[Type] IN ('P', 'L', 'M') AND [Value] IS NOT NULL", "[Text] ASC").CopyToDataTable.DefaultView '<---This is the error line
        DT_Feedyard = View.ToTable(True, "Text", "Value")
        FilterBinder_Feedyard.DataSource = DT_Feedyard

the error im getting is this:
'DT.Select("[Type] IN (' threw an exception of type 'System.InvalidOperationException'

the data in DT at this moment shows empty cells on columns 14 and 15......

i was assuming that this select statement would just return an empty table if the filter criteria where not matched? and i cannot test every record to see exactly where the error occurs


INSIGHT:

the IN() statement is picking up the parent in a multi level table (ie the frst row of the stack) in this particular case the type is L

there is only 1 stack in this table, the first row has type L, the children all have type I. which is what i want, this filter is to filter the parent records....

here is the table

the first item here is the parent and everything under is the child........ my filter should just take column 14,15 values (between O and 12227 which you cannot see here because they are empty)

the Type field is the 4th column, u can see the L and all the I's
  • False 12227 L Corn 12227
  • False 12227 2769 I Initial C Z7C450 3/7/2017 12:00:00 AM S 50 0.15 87.5 68.5 0.5 O 12227
  • False 12227 3377 I Initial C Z7C380 4/28/2017 12:00:00 AM B 30 0.28 52.5 41.1 0.3 O 12227
  • False 12227 3462 I Initial C Z8 5/8/2017 12:00:00 AM B 5 3.99 2.75 9.75 0.05 O 12227
  • False 12227 3793 I Initial C Z7C450 5/22/2017 12:00:00 AM S 25 0.13 43.75 34.25 0.25 O 12227
  • False 12227 4420 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.875 1.1 3.9 0.02 O 12227
  • False 12227 4421 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8775 1.1 3.9 0.02 O 12227
  • False 12227 4422 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8725 1.1 3.9 0.02 O 12227
  • False 12227 4423 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.875 1.1 3.9 0.02 O 12227
  • False 12227 4424 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8725 1.1 3.9 0.02 O 12227
  • False 12227 5138 I Initial C Z8 10/20/2017 12:00:00 AM B 5 3.92 2.75 9.75 0.05 O 12227
  • False 12227 5335 I Initial C Z8 11/9/2017 12:00:00 AM B 10 3.91 5.5 19.5 0.1 O 12227
  • False 12227 5434 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5435 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5436 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5437 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5438 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5439 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
  • False 12227 5448 I Initial C Z7C450 11/24/2017 12:00:00 AM B 75 0 0 7.5 0 O 12227


any ideas whats going on here?

This is the actual data too ive not changed anything

VS 2013 unreliable serial port comunications

$
0
0
Im trying to send some information over a serial port to an ardiuno , I had the whole porbgram working perfectly but now it only works some times. I beleive the problem lies in the following code

SerialPort1.Write("w")
SerialPort1.Write(textbox1.Text)
SerialPort1.Write("\n")

Is this an acceptable way to write to serial , it seems to work but only sometimes, If i send the same nubers to the arduino with a serial monitor is responds as expected so it must be the way it is set here.
Is there any other possibilities

VB6 and back end SQL DB Options

$
0
0
Does anyone have any suggestions on where we could get some help/advice on improving our VB6 - Database Options? We have been using the Access/MDB/Jet Engine without problems but many of our potential customers have a less than favorable view of Access. We did add SQL Server 2008 years ago for one customer but haven't pushed it for any others. We were looking at perhaps using recent version of SQL Server but those don't run on windows 7 so we can't run VB6 IDE to connect, test, debug, etc. Thanks for any advice on options.

VS 2013 Form and text blurry when users change magnification

$
0
0
Hello all,
I have been researching this for days and I have not found a fix that work yet. The issue I'm having is a few users have set their desktop to 125% magnification and my program forms are blurry and parts of the forms are missing when I have the size locked.
I'm using VS 2013 and have tested the AutoScaleMode/AutoSize options without success.
Any thoughts or suggestions would be appreciated.

VS 2013 Form text blurry when users change magnification

$
0
0
Hello all,
I have been researching this for days and I have not found a fix that work yet. The issue I'm having is a few users have set their desktop to 125% magnification and my program forms are blurry and parts of the forms are missing when I have the size locked.
I'm using VS 2013 and have tested the AutoScaleMode/AutoSize options without success.
Any thoughts or suggestions would be appreciated.

VS 2015 Search & loading a BindedControl

$
0
0
Good morning,

I am working in Visual Studio, I have Binded some controls in the designer and I am trying to get sorted results to load on my form.

Code:

Tbl_InstitutionsTableAdapter.Fill(Me.BudgetDataSet.tbl_Institutions)
        Tbl_InstitutionsBindingSource.DataSource = BudgetDataSet.tbl_Institutions

I have this and it loads the first item in the Access database, but I want to be able to search the database and then load the result.

What am I missing here?

Richard

Open & Run Multiple Macros /w Hotkey & Chosen Key.

$
0
0
I used VB6 a very long time ago & thought it might be useful for a simple program I want to use during a game. I've forgotten I guess all of the VB6 I knew, so am pretty much starting from scratch.

The idea is to open & run multiple macros (.amc format) with hotkeys (ON/OFF) & changable activation key.

Outline.
- File Macro (.amc) - Browse & load the macro file.
- Select Hotkey - Toggle ON / OFF.
- Activation Key - When pressed it'll activate the macro (Key Or Mouse Button)
- Activation Icon - Red / Green light to show it's ON / OFF.

Example.

jump-spam.amc [Browse File] F1 [Hotkey] Space [Key] Red [OFF]
jump-throw.amc [Browse File] F2 [Hotkey] X [Key] Red [OFF]
bunnyhop.amc [Browse File] F3 [Hotkey] Z [Key] Green [ON]
burst.amc [Browse File] F4 [Hotkey] LeftMB [Key] Green [ON]
quickswitch.amc [Browse File] F5 [Hotkey] RightMB [Key] Red [OFF]

---

Similar to this program
: https://www.youtube.com/watch?v=BjbbHQEJb9U

---

Example macro: https://ufile.io/o7eou

If you do not want to download the file, you can view it here.

Code:

<Root>
        <DefaultMacro>
                <Major></Major>
                <Description>
</Description>
                <Comment>
</Comment>
                <GUIOption>
                        <RepeatType>1</RepeatType>
                </GUIOption>
                <KeyUp>
                        <Syntax></Syntax>
                </KeyUp>
                <KeyDown>
                        <Syntax>


LeftDown 1
Delay 24 ms
MoveR -1 2
Delay 24 ms
MoveR -1 2
Delay 24 ms
MoveR -1 2
Delay 24 ms
MoveR -1 2

Delay 24 ms
MoveR 1 4
Delay 24 ms
MoveR 1 5
Delay 24 ms
MoveR 1 5
Delay 24 ms
MoveR 1 4

Delay 24 ms
MoveR 0 7
Delay 24 ms
MoveR 0 7
Delay 24 ms
MoveR 0 7
Delay 24 ms
MoveR 0 8

Delay 24 ms
MoveR 0 8
Delay 24 ms
MoveR 0 7
Delay 24 ms
MoveR 0 8
Delay 24 ms
MoveR 0 7

Delay 24 ms
MoveR 1 7
Delay 24 ms
MoveR 2 7
Delay 24 ms
MoveR 2 7
Delay 24 ms
MoveR 2 7

Delay 24 ms
MoveR 2 7
Delay 24 ms
MoveR 2 7
Delay 24 ms
MoveR 1 7
Delay 24 ms
MoveR 2 6

Delay 24 ms
MoveR 3 6
Delay 24 ms
MoveR 3 6
Delay 24 ms
MoveR 3 6
Delay 24 ms
MoveR 2 6

Delay 24 ms
MoveR -4 4
Delay 24 ms
MoveR -4 4
Delay 24 ms
MoveR -4 4
Delay 24 ms
MoveR -4 4

Delay 24 ms
MoveR -8 -1
Delay 24 ms
MoveR -9 -1
Delay 24 ms
MoveR -9 -1
Delay 24 ms
MoveR -8 -1

Delay 24 ms
MoveR -6 1
Delay 24 ms
MoveR -6 1
Delay 24 ms
MoveR -6 1
Delay 24 ms
MoveR -6 1

Delay 24 ms
MoveR 3 1
Delay 24 ms
MoveR 4 2
Delay 24 ms
MoveR 3 2
Delay 24 ms
MoveR 3 2

Delay 24 ms
MoveR -3 2
Delay 24 ms
MoveR -4 1
Delay 24 ms
MoveR -3 1
Delay 24 ms
MoveR -3 1

Delay 24 ms
MoveR -6 -1
Delay 24 ms
MoveR -7 -2
Delay 24 ms
MoveR -7 -2
Delay 24 ms
MoveR -7 -2

Delay 24 ms
MoveR -1 1
Delay 24 ms
MoveR -1 1
Delay 24 ms
MoveR 0 1
Delay 24 ms
MoveR 0 1

Delay 24 ms
MoveR 9 1
Delay 24 ms
MoveR 10 1
Delay 24 ms
MoveR 9 2
Delay 24 ms
MoveR 9 1

Delay 24 ms
MoveR 5 1
Delay 24 ms
MoveR 5 2
Delay 24 ms
MoveR 5 1
Delay 24 ms
MoveR 5 1

Delay 24 ms
MoveR 3 1
Delay 24 ms
MoveR 3 2
Delay 24 ms
MoveR 3 1
Delay 24 ms
MoveR 3 1

Delay 24 ms
MoveR 7 -1
Delay 24 ms
MoveR 7 -1
Delay 24 ms
MoveR 7 -1
Delay 24 ms
MoveR 7 -1

Delay 24 ms
MoveR 8 -1
Delay 24 ms
MoveR 9 -1
Delay 24 ms
MoveR 8 -1
Delay 24 ms
MoveR 8 -1

Delay 24 ms
MoveR -4 0
Delay 24 ms
MoveR -5 1
Delay 24 ms
MoveR -5 1
Delay 24 ms
MoveR -5 0

Delay 24 ms
MoveR 1 0
Delay 24 ms
MoveR 1 1
Delay 24 ms
MoveR 1 1
Delay 24 ms
MoveR 1 0

Delay 24 ms
MoveR -1 0
Delay 24 ms
MoveR -1 1
Delay 24 ms
MoveR -2 1
Delay 24 ms
MoveR -2 0

Delay 24 ms
MoveR -2 0
Delay 24 ms
MoveR -2 1
Delay 24 ms
MoveR -2 1
Delay 24 ms
MoveR -2 0

Delay 24 ms
MoveR 4 0
Delay 24 ms
MoveR 5 0
Delay 24 ms
MoveR 5 0
Delay 24 ms
MoveR 5 -1

Delay 24 ms
MoveR 1 0
Delay 24 ms
MoveR 2 0
Delay 24 ms
MoveR 2 0
Delay 24 ms
MoveR 1 0

Delay 24 ms
MoveR -5 0
Delay 24 ms
MoveR -5 0
Delay 24 ms
MoveR -5 0
Delay 24 ms
MoveR -6 0

Delay 24 ms
MoveR -7 0
Delay 24 ms
MoveR -8 0
Delay 24 ms
MoveR -8 0
Delay 24 ms
MoveR -8 1

Delay 24 ms
MoveR -12 -4
Delay 24 ms
MoveR -12 -5
Delay 24 ms
MoveR -12 -5
Delay 24 ms
MoveR -11 -5

Delay 24 ms
MoveR -7 0
Delay 24 ms
MoveR -8 0
Delay 24 ms
MoveR -7 0
Delay 24 ms
MoveR -8 0

Delay 970 ms
Delay 970 ms</Syntax>
                </KeyDown>
                <Software>cs:go..LH..sens-2.52
</Software></DefaultMacro>
</Root>

---

Is it possible to do this within VB6?

I can use the program they provide, but am interested in making / using a simpler version.

Thanks,
Guy M

VS 2017 solved ManagementEventWatcher process name character limit?

$
0
0
I'm trying to use eventwathcer but its not working with 11 characters process name (AbcdEfghIII.exe). If I write 10 characters process name (AbcdEfgIII.exe) its working.
Is there character limit or am I doing something wrong? Here is my code:


Code:

    Imports System.Management

    Public Class Form1
Dim WithEvents StopWatch As New ManagementEventWatcher(New WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace"))

Private Sub StopWatch_EventArrived(ByVal sender As Object, ByVal e As System.Management.EventArrivedEventArgs)
    If e.NewEvent.Properties("ProcessName").Value.ToString = "AbcdEfghIII.exe" Then
        MsgBox("Closed")
    End If
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    StopWatch.Stop()
    RemoveHandler StopWatch.EventArrived, AddressOf StopWatch_EventArrived
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Try
        AddHandler StopWatch.EventArrived, AddressOf StopWatch_EventArrived
        StopWatch.Start()
    Catch g As Exception
        MsgBox("Please, run as admin.", MsgBoxStyle.Critical, "Error")
        Me.Close()
    End Try
End Sub
End Class

[RESOLVED] OnGoodRecord ?

$
0
0
Okay, here's one I haven't done before. I will be using it for the DAO, but I suspect it'll be exactly the same for the ADO.

MS-Access database.

I need a general purpose function that I pass a Recordset to, and it tells me whether or not I'm sitting on a valid record.

Things I've thought of are exploring the .Bookmark property, or possibly checking a combination of .BOF, .EOF, and .RecordCount. However, I also need to handle the case where I'm sitting on a deleted record (in which case I want to return False).

I'd prefer to not use error trapping, but I will if I need to. That's really no biggie either way.

Also, I'm not really worried about .EditMode. When using this function, I'll never be in any editing mode.

Thanks,
Elroy

Invoice amount to be rounded up when it is retrieved from MS Access DB?

$
0
0
Hi,

How to change the following code to get the InvoiceAmount to be rounded up? For example, if the InvoiceAmount is 55,499.65, then it should be rounded up to 55,500.

Code:

"Select CustomerName,InvoiceNumber,InvoiceDate,SUM(InvoiceAmt) AS InvoiceAmount from SalesDB WHERE [InvoiceDate] BETWEEN #" & dtpDateFrom.Value & "# And #" & dtpDateTo.Value & "# GROUP BY CustomerName,InvoiceNumber,InvoiceDate ORDER BY InvoiceDate ASC"

Thanks.

Email same person multiple files

$
0
0
I am trying to create a script that can email multiple files from a single folder to the same person where each file is attached to a separate email. Can anyone help?

NJ

[RESOLVED] Passing variable ByRef to a form (possibly modal), Aliasing?

$
0
0
This is another one I've struggled with for years, so I'm going to toss it out here.

Let's say I've got three variables declared locally (possibly either scoped for the module, or maybe even the procedure).

And now, I'd like to show a modal form and ask a couple of questions. And the answers to these questions need to set those three variables. And then my modal form unloads, returns control to the procedure that called it (where the three variables are).

Now, I do this in a few different places, where that modal form is somewhat generic to several processes. Here's the problem. There's no easy way to get those three variables into the modal form.

I can Load, and then set some Public variables in the form, and then Hide (not unload), and then retrieve them. But that's sloppy.
Another approach would be to use some global/BAS variables for transfers. But that's also sloppy.

I'd rather just find a way to pass them in ByRef. This feels like aliasing, as it's not just one procedure I'm passing them to. It's the whole form/COM object.

I'm toying around with using some VarPtr trick to do it. When I'm done with my modal form, I'd really prefer to just completely unload it (including its associated COM code) and be done, not worrying about retrieving my variable values.

Any other ideas are welcome.

Elroy

EDIT1: I also need to pass in certain objects, but that's easy. Objects are trivial to alias, but regular variables not so much.

Intel Optane

$
0
0
Has anyone had any experience with the new Intel Optane. I'm really curious about how it stacks up against a SSD, especially on system startups or restarts. I love my SSD because of it's speed on startup or restarts. I've read some of the articles but haven't read anything about the startup and restart process speed.

DataEnvironment

$
0
0
At present there is a table called Table1 in my Access DB.
In Dataenvironment under a command 'Students" I put a code "Select * from Table1".
I assigned this command as 'Datamember' to one of my DataReport. It works fine.......

Now I want to do it at run time. i.e.
1. To create a Table programatically and not in Access base
2. Assign it to the command
3. Retrieve it from the DataReport.

Step 1 above I know how to do. I want to know about Steps 2 & 3 above. Please help me.

Copyrights when author creates a project

sort Dictionary array....

$
0
0
in MyDict have this array:

01-2017
03-2014
02-2017
...
08/2012

are month and year...

how to sort and to have now:

08/2012
03-2014
01-2017
02-2017
...

How can catch myself crash event

$
0
0
Code:


Private Sub Form_Activate()
Dim a(1) As Long

a(100000) = 1 'let Form crash
End Sub

Private Sub Form_Unload(Cancel As Integer)
  MsgBox "Form crash !!"
End Sub

Name:  S2sonN2.gif
Views: 1
Size:  6.4 KB

Hello everyone ~

How can to catch Form myself crash event ?

thanks
Attached Images
 
Viewing all 42486 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>