Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all 27389 articles
Browse latest View live

VS 2008 [RESOLVED] Upgrade VB6 to VB.NET - new pc, problem with libraries - msdatasrc.DataSource require

$
0
0
Hi!

I just moved my project from one pc to a new one, and I cannot solve this issue:
Code:

Error        126        Reference required to assembly 'MSDATASRC, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' containing the type 'msdatasrc.DataSource'. Add one to your project.        C:\pathtoform\myForm.Designer.vb        646        9
The error line contains this:
Code:

grid.DataSource = r
with the error marked on left part.

In the project properties I have a reference to "Microsoft Data Source Interfaces for ActiveX Data Binding Type Library" called Interop.MSDATASRC.dll.
This is the only reference that I can link to the error, but obviously this is not sufficient.

The project includes also a reference to DDSharpGridOLEDB2U, which is the base class for the grid in the error rising code.
Code:

Me.grid2 = New AxDDSharpGridOLEDB2U.AxSGGrid

VS 2010 change event when mouse is clicked outside a panel

$
0
0
Hi i am trying to work out the event that handles when i click outside a area "i guess that is how to put it"

This is exactly what i mean

I have a panel i.e
Code:

ProfileNamePanel
and a text box i.e

Code:

Profile_NameTextBox
I whish for the ProfileNamePanel to change color when i click inside the Profile_NameTextBox which i obviously done using

Code:


    Private Sub Profile_NameTextBox_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Profile_NameTextBox.MouseClick


        ProfileNamePanel.BackColor = Color.Aquamarine

    End Sub

BUT now i am stuck trying to work out what event handles changing the color again say to black once i have clicked away from

Profile_NameTextBox


So in short i whish to change a panels color when i click on a textbox then after i finish that textbox and click elsewhere i want to change the color of the panel again.

Cheers in advance

DatatGridView Advanced Styling

$
0
0
Hi Need help in styling a DGV that is attached to a Dataset using the database built in to VB,

1)How do i go about changing the color of each row

Example :-
First Row Background Color = #F1F1F1
Next Row Background Color = #FFFFFF

Every Row after that is repeated

2) How do i Go about having No Border for a column But Border For Rows i.e

Demo Pic also includes the Row color example from question 1

Attachment 99841

3) How can i have the whole DGV area filled with empty rows when the form loads

Example :-

Say the dataset only has 3 rows of data but the DGV area on the form can contain 9
How can i make the remainding 6 rows show on screen empty.


Attachment 99845



Sorry if this is all to much but i have honestly been playing in vb around and browsing google for 2 weeks trying to work this out but have had no luck

Thanks in advanced
Attached Images
   

VS 2010 timer and mousemove problems

$
0
0
Hi folks.

I am creating a screensaver app, using a timer to display a different picture every 10 seconds.

1. Why does my code result in an initial blank picturebox displayed for 10 seconds, and then the other pics are displayed after? I don't understand why the blank picturebox is displayed.

2. I want the form to close when the mouse is moved(the screensaver to stop running), so I set the mousemove event to close the form, but when I move the mouse, the form doesn't close. Why?

Thanks in advance.

Code:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Static ctr As Integer = 0
        Dim pics() As Image = {My.Resources._1, My.Resources._2, My.Resources._3, My.Resources._4, My.Resources._5, My.Resources._6}

        PictureBox1.Image = pics(ctr)
        ctr = ctr + 1
        If ctr > 5 Then
            ctr = 0
        End If
    End Sub

    Private Sub PictureBox1_Click(sender As Object, e As System.EventArgs) Handles PictureBox1.Click
        Me.Close()
    End Sub

    Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        Me.Close()
    End Sub
End Class

Automating Programs

$
0
0
Hey,

I am trying to get a hold of another application and simply send the print command. But this seems to be hard than I thought it was.

I know there is the automation name space, but I cant seem to get anything working.
http://msdn.microsoft.com/en-us/libr...utomation.aspx

I am still at the very beginning of my test application, I am only able to open the 3rd party application and I am stuck there.

Any suggestions are appreciated :)

VS 2010 Passing checked items/process to other form

$
0
0
Hi,

Anyone can help, pass all checked listview items into my install form??

And then start process in install form... Here's what I have:
Code:

If ListView1.CheckedItems.Count > 0 Then
            For Each Item As ListViewItem In ListView1.CheckedItems
                '//Install
                'install = lVI.Checked
            Next
            Me.Hide()
            InstallPrograms.Show()
        Else
            MessageBox.Show("Nothing selected to install!")

        End If

VS 2010 set RightToLeft=True only for one Column of a Datagridview

$
0
0
hi

i want to set RightToLeft=true for only one column of a datagridview.how can i do this?

Time Stamp / Storage of Time in DB

$
0
0
Hello all

I Am storing time in a SQL db and right now the time is stored in HH.MM.SS
I would like to only store the HH.MM.
I know how to use the following to string

DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")

but I am not storing in in String I storing in in a time field.

I guess All i need to do is change the seconds to 00.

ie 17:39:47 changed to 17:39:00

Thanks

VS 2008 Microsoft Ado.net sync framework conflict

$
0
0
hello all,

I have a project that sync the client and the server. i'm using northwind database and customer table for testing purpose.

here is the case.

SERVER SIDE:

Record 001 - Company Name changed



CLIENT SIDE:

Record 001 -Contact Name changed.


when I sync, the company Name changes updated in Client side, but Contact name changes made on the client side never updated on the server.

I created the code below to detect the conflict and get the changes in the client side and server:

HTML Code:


Partial Public ClassNorthwindCache1ServerSyncProvider
   
    Private Sub NorthwindCacheServerSyncProvider_ApplyChangeFailed( _
    ByVal sender As Object, ByVal e As Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs) Handles Me.ApplyChangeFailed
        If e.Conflict.ConflictType = Microsoft.Synchronization.Data.ConflictType.ClientUpdateServerUpdate Then
            Dim ClientChanges As DataTable = e.Conflict.ClientChange
            Dim ServerChanges As DataTable = e.Conflict.ServerChange
           
            'if I will issue the command below
           
            e.Action = Microsoft.Synchronization.Data.ApplyAction.RetryWithForceWrite

            ' Client side will win and what will happen the changes made on the same record on the server side will not be updated to client side.
         
        End If
   
    End Sub

can you guys please give me some suggestion on how to the apply the this business rule to this scenario?

VS 2012 Multiple threading for my program issues!

$
0
0
Hello! Newbie here :)

I am trying to make multiple threads for my Web Crawler program. I am expanding upon some old code I found lying around the internet.
It needs to be multi threaded or else everything freezes and gives no response or output until it is done what it is doing (which can take anywhere from 30 seconds to an hour).
I know how to make threads but since this is not entirely my code and the comments are not the greatest, I haven't been able to implement the threads.

Can anybody help me out?

Here is the code below.

Code:

Imports System.IO
Imports System.Net
Imports System.Text.RegularExpressions

Public Class web_crawler

    Private Sub startCrawl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startCrawl.Click
        output.Items.Clear()

        currentOperation.Text = "Begining Spider to find links..."
        Dim aList As ArrayList = Spider(inputURL.Text, depth.Text)

        currentOperation.Text = "Populating list of URLS..."
        For Each url As String In aList
            Dim crawlReq As WebClient = New WebClient
            crawlReq.Headers("User-Agent") = "MCLMATTY CRAWLER"
            currentOperation.Text = "Requesting " & url & "..."
            Dim arr() As Byte = crawlReq.DownloadData("http://search-engine.crawler.mclmatty.net/crawler.php?url=" & url)
            output.Items.Add("Found: " & url)
        Next

        currentOperation.Text = "Done. Awating new user input."
        output.Items.Add("Done")
    End Sub
    Private Function Spider(ByVal url As String, ByVal depth As Integer) As ArrayList
        'aReturn is used to hold the list of urls
        currentOperation.Text = "Creating Arrays..."
        Dim aReturn As New ArrayList
        'aStart is used to hold the new urls to be checked
        Dim aStart As ArrayList = GrabUrls(url)
        'temp array to hold data being passed to new arrays
        Dim aTemp As ArrayList
        'aNew is used to hold new urls before being passed to aStart
        Dim aNew As New ArrayList
        'add the first batch of urls
        currentOperation.Text = "Populating Arrays..."
        aReturn.AddRange(aStart)
        'if depth is 0 then only return 1 page
        If depth < 1 Then Return aReturn
        'loops through the levels of urls
        For i = 1 To depth
            'grabs the urls from each url in aStart
            For Each tUrl As String In aStart
                'grabs the urls and returns non-duplicates
                aTemp = GrabUrls(tUrl, aReturn, aNew)
                'add the urls to be check to aNew
                aNew.AddRange(aTemp)
            Next
            'swap urls to aStart to be checked
            aStart = aNew
            'add the urls to the main list
            aReturn.AddRange(aNew)
            'clear the temp array
            aNew = New ArrayList
        Next
        Return aReturn
        loopyThread.Abort()
    End Function
    Private Overloads Function GrabUrls(ByVal url As String) As ArrayList
        'will hold the urls to be returned
        Dim aReturn As New ArrayList
        Try
            'regex string used: thanks google
            currentOperation.Text = "Matching reqular expressions..."
            Dim strRegex As String = "<a.*?href=""(.*?)"".*?>(.*?)</a>"
            'Some regex notes... <a.*?href=""(.*?)"".*?>(.*?)</a>
            'And again... (?<=href\="")[^]+?(?="")

            'i used a webclient to get the source
            'web requests might be faster
            Dim wc As New WebClient
            'put the source into a string
            Dim strSource As String = wc.DownloadString(url)
            Dim HrefRegex As New Regex(strRegex, RegexOptions.IgnoreCase Or RegexOptions.Compiled)
            'parse the urls from the source
            Dim HrefMatch As Match = HrefRegex.Match(strSource)
            'used later to get the base domain without subdirectories or pages
            Dim BaseUrl As New Uri(url)
            'while there are urls
            While HrefMatch.Success = True
                'loop through the matches
                Dim sUrl As String = HrefMatch.Groups(1).Value
                'if it's a page or sub directory with no base url (domain)
                If Not sUrl.Contains("http://") Or sUrl.Contains("https://") AndAlso Not sUrl.Contains("www") Then
                    'add the domain plus the page
                    Dim tURi As New Uri(BaseUrl, sUrl)
                    sUrl = tURi.ToString
                End If
                'if it's not already in the list then add it
                If Not aReturn.Contains(sUrl) Then aReturn.Add(sUrl)
                'go to the next url
                HrefMatch = HrefMatch.NextMatch
            End While
        Catch ex As Exception
            'catch ex here. I left it blank while debugging
        End Try

        Return aReturn
    End Function
    Private Overloads Function GrabUrls(ByVal url As String, ByRef aReturn As ArrayList, ByRef aNew As ArrayList) As ArrayList
        'overloads function to check duplicates in aNew and aReturn
        'temp url arraylist
        Dim tUrls As ArrayList = GrabUrls(url)
        'used to return the list
        Dim tReturn As New ArrayList
        'check each item to see if it exists, so not to grab the urls again
        For Each item As String In tUrls
            If Not aReturn.Contains(item) AndAlso Not aNew.Contains(item) Then
                tReturn.Add(item)
            End If
        Next
        Return tReturn
    End Function
End Class

2nd Form Load interupted by 1st forms calling event

$
0
0
Hello Everyone,

Going a little crazy looking for an answer.

There are two forms, Search and View. Search is the startup form and has a button linking to View. My problem is that my view form does not complete it's FormLoad event when called from Search, it however behaves fine when made the startup form, bypassing Search altogether. I have tried several OnClick events for my button in Search but nothing seems to make a difference. Currently I am using:
View.Show()
Me.Hide()

When I try to debug, the program counter begins cycling through all the form load events of View, calling a few Subroutines but on the last Subroutine it breaks away early and ends up at Me.Hide() in the button event. Once the button event finishes the debug stops and the form is partially loaded.

From what I can tell it has nothing to do with the subroutine that it halts on. Anyone farmiliar with this issue and have any advice?

Thanks a lot!

Moved my VB6 upgrade project to a new machine and cannot open forms in designer

$
0
0
Hi!

I moved my VB6 to VB.NET upgrade project to a new machine. I can compile the application (with many warnings), but I cannot open some forms in the Designer. It says:
Code:

To prevent possible data loss before loading the designer, the following errors must be resolved: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
And the first Call stack says:
Code:

1.  Hide Call Stack
 
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.set_Site(ISite value)
at System.ComponentModel.Container.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)

At first I suspected the cause to be in "grid As AxDDSharpGridOLEDB2U.AxSGGrid", because this is the only visual element that differs from the forms which I can open. But even commenting out every use of this grid in the form.Designer.vb file kept the Call Stack from above. In the Error List those errors are listed as Messages and the referenced line ir 0 and column is 0.
While there are still many warnings in the error list, I believe the Designer cannot open the form due to some other issue, because no other of the warnings refers to the form.Desiger.vb file.

I get this problem on two machines, one Win 8 with VB Express 2008 and the other with Win 7 and VB Express 2012. Tomorrow I will try to comment out step by step everything on the form, maybe this will reveal the problem.

VB 2010 and database on website

$
0
0
I have an application that connects to a database on my computer. What I want to do is host this database on my website. How would I go about changing the Data Source from a local file on my computer to a database on my personal website (hosted by GoDaddy)? The database is basically for saving the data of a character. The vb application will be the game that a user can install. I just want the data saved to a database on the website instead of on their local machine. Is this easily doable? It is an Access database(.accdb). Thank you.

VS 2010 Can WebBrowser change a HTML code?

VS 2012 unbound column doesn't show result

$
0
0
Hi,

VB newbe looking for some help. :)
i have a datagrid with 8 columns (id, ean, name, description, price, totalprice, a spacer column and vat)

i like to show a calculated column in a datagrid showing price inc. vat (totalprice)
So i created a unbound column wich is on index 5 and when i try to populate that column it doesn't show the results.


Code:


        For Each r As DataGridViewRow In Me.dataGridProducts.Rows
 
            TotaalPrijs = r.Cells(4).Value + (r.Cells(4).Value * r.Cells(8).Value / 100)
            r.Cells(5).Value = totaalPrijs
                 
 

        Next

when i use the index of any other bound column it shows me the result in the wrong column (category column)



Code:

        For Each r As DataGridViewRow In Me.dataGridProducts.Rows
 
            TotaalPrijs = r.Cells(4).Value + (r.Cells(4).Value * r.Cells(8).Value / 100)
            r.Cells(6).Value = totaalPrijs
                 
 

        Next

Any help would be appriciated

VS 2010 Help Understanding Basic MEF development

$
0
0
Hi

i just started looking into this today and i think i understand it but the example from microsoft that i was learning from has the usual extra stuff that doesnt really need to be there. and im having a hard time getting my head around it

just for practice i want to hard code the 'part' since i know how to get the parts from files already.

this is what i have so far

1 form with 1 datagridview 1 textbox 1 button

i want to put a path to an xl file press the button and let the 'part' start an oledb connection read the xl file close connection and then send the object back
(as an object since i may use it for other types later) oledb is not a problem i can do that, its purely the MEF side of things.

so... the code haha wait for it
Code:

Public module module1
public interface IGetFileData
        Function GetFileData(fullpath as string)as object
end interface

<a program class i think needs to go here, its shown below, which will be instantiated when i press the button i think>

end module

and then i got stuck with the way microsoft showed it all on msdn
this i think i need but it has parts of the calculator example on it <below>

Code:

Public Class Program
        Dim _container As CompositionContainer

        <Import(GetType(ICalculator))>
        Public Property calculator As ICalculator


        Public Sub New()
            'An aggregate catalog that combines multiple catalogs
            Dim catalog = New AggregateCatalog()

            'Adds all the parts found in the same assembly as the Program class
            catalog.Catalogs.Add(New AssemblyCatalog(GetType(Program).Assembly))

            'IMPORTANT!
            'You will need to adjust this line to match your local path!
            catalog.Catalogs.Add(New DirectoryCatalog("C:\Users\Main Admin\Documents\Visual Studio 2010\Projects\MEF Calculator\SimpleCalculator2\Extensions"))


            'Create the CompositionContainer with the parts in the catalog
            _container = New CompositionContainer(catalog)

            'Fill the imports of this object
            Try
                _container.ComposeParts(Me)
            Catch ex As Exception

            End Try
        End Sub

    End Class

and i need to strip the code here to start the 'Part' that i actually need to use, but it looks like theres more interfaces then i actually need, im not sure the example used a console heres some more <below>

Code:

<Export(GetType(ICalculator))>
    Public Class MySimpleCalculator
        Implements ICalculator

        <ImportMany()>
        Public Property operations As IEnumerable(Of Lazy(Of IOperation, IOperationData))


        Public Function Calculate(ByVal input As String) As String Implements ICalculator.Calculate
            Dim left, right As Integer
            Dim operation As Char
            Dim fn = FindFirstNonDigit(input) 'Finds the operator
            If fn < 0 Then
                Return "Could not parse command."
            End If
            operation = input(fn)
            Try
                left = Integer.Parse(input.Substring(0, fn))
                right = Integer.Parse(input.Substring(fn + 1))
            Catch ex As Exception
                Return "Could not parse command."
            End Try
            For Each i As Lazy(Of IOperation, IOperationData) In operations
                If i.Metadata.Symbol = operation Then
                    Return i.Value.Operate(left, right).ToString()
                End If
            Next
            Return "Operation not found!"
        End Function

        Private Function FindFirstNonDigit(ByVal s As String) As Integer
            For i = 0 To s.Length
                If (Not (Char.IsDigit(s(i)))) Then Return i
            Next
            Return -1
        End Function


    End Class


heres the interfaces and 1 of the parts <below>

Code:

    Public Interface ICalculator
        Function Calculate(ByVal input As String) As String
    End Interface

    Public Interface IOperation
        Function Operate(ByVal left As Integer, ByVal right As Integer) As Integer
    End Interface

    Public Interface IOperationData
        ReadOnly Property Symbol As Char
    End Interface


    <Export(GetType(IOperation))>
    <ExportMetadata("Symbol", "+"c)>
    Public Class Add
        Implements IOperation

        Public Function Operate(ByVal left As Integer, ByVal right As Integer) As Integer Implements IOperation.Operate
            Return left + right
        End Function
    End Class

please help :), i understand what is happening a little
but i never used an interface before but i looked it up i think i get that, why are they using so many though

the import/export i understand is checking if the 'part' is allowed to be used, i dont understand the syntax though for them both,

Code:

<Export(GetType(IOperation))>
    <ExportMetadata("Symbol", "+"c)>

<ImportMany()>
        Public Property operations As IEnumerable(Of Lazy(Of IOperation, IOperationData))

i know someone who has done this should easily help me out here.

[RESOLVED] Group Radio Buttons

$
0
0
So i have just noticed that when i used vb i created a in built vb database within this database i had 3 Radio Buttons

Now when i added them to the form using a dataset you could only check 1 of the rasdio buttons and every time you checked another 1 the previous one was un checked.

Now i am using VS2010 and i done the same thing but now you can check all 3 Radio buttons and you can not uncheck them??????
WHY????????????????


Can any 1 help me achieve this in VS2010 see i have 3 radio buttons that will all give a variable a different Integer Number and i need to
only allow 1 check box checked at any given time.

Avoiding calling of DataGridView.CellValueNeededc when mouse moves over cells

$
0
0
Hi,
we are using DataGridView in our application.I noticed that DataGridView.CellValueNeeded is called when i move the mouse over the cells.After some searching i found that When the mouse moves to a cell, the
DataGridView will show a tooltip to show the completed content of the cell if its value cannot be displayed completely in the cell. This will help the user see the complete content of the cell when necessary and it is
the default behavior of the DataGridView. As a result, the CellValueNeeded event will be fired when we move the mouse on it, since it needs the value to format and construct the ToolTip. I don't know if it is correct in my case.Is it?if yes is there anyway to avoid it?
Thank you

DefaultCellStyle.NullValue or setting standard error graphic to Bitmap

$
0
0
i have a databound DGV and need to replace the standard error graphic to my own Image so when the user clicks add new the ugly red cross icons do not show

i have read the info on MSDN and done some google searches as well as a lot of playing around with code but cant seem to get it to work


Source for this http://msdn.microsoft.com/en-AU/libr...=vs.85%29.aspx
So this is what i can understand so far and what i have tried

according to MSDN to change the standard error image you set the DataGridViewCellStyle.NullValue property for this cell style object to a null reference

So i tried

Code:

ProfilesDataGridView.DefaultCellStyle.NullValue = vbNull
However i get this error

Quote:


the following exception occured in the datagridview:

system.formatException: Formated value of the cell has wrong type

BUT all that just disables the standard error image i think?

I need to know how to change the image from icon to bitmap so i can use my own png image.

Media Player forward function not working

$
0
0
Hello,

I have a form with a Media Player object embedded. In the bin folder I have a folder named Movies where are a couple of movie files. I want to read all the files in that folder and make media player run them. For that I created a forward() function that works fine when I press the right arrow key. The problem is that it doesn't work with PlayStateChange event. It simply stops and doesn't read the following file. But if I press the play button it plays the next file. The problem is that I want it to play automatically. Here is the script:

Imports AxWMPLib.AxWindowsMediaPlayer

Public Class Form1
Dim fileNames As New List(Of String)
Dim index As Integer = 0

Private Sub frmPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim files = My.Computer.FileSystem.GetFiles("Movies")

fileNames.Clear()
index = 0
For i = 0 To files.Count - 1
fileNames.Add(files(i))
Next

play(index)
End Sub

Private Sub play(ByVal index As Integer)
AxWindowsMediaPlayer1.URL = fileNames(index)
AxWindowsMediaPlayer1.Ctlcontrols.play()
End Sub

Private Sub forward()
index += 1
If index > fileNames.Count - 1 Then
index = 0
End If
play(index)
End Sub

Private Sub backward()
index -= 1
If index < 0 Then
index = fileNames.Count - 1
End If
play(index)
End Sub

Private Sub AxWindowsMediaPlayer1_KeyUpEvent(ByVal sender As System.Object, ByVal e As AxWMPLib._WMPOCXEvents_KeyUpEvent) Handles AxWindowsMediaPlayer1.KeyUpEvent
Select Case e.nKeyCode
Case Keys.Right
forward()
Case Keys.Left
backward()
End Select
End Sub

Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
If e.newState = WMPLib.WMPPlayState.wmppsMediaEnded Then
forward()
End If
End Sub

End Class

ANOTHER PROBLEM is that when in fullscreen mode the KeyUp event doesn't work anymore so I can't advance through the files.

Any help?
Thx
Viewing all 27389 articles
Browse latest View live


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