All I'm trying to do is get the duration of a song before the player starts and load it into a label.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
Player1.settings.autoStart = False
Player1.URL = OpenFileDialog1.FileName
Label2.Text = Player1.currentMedia.name
Label1.Text = Player1.currentMedia.duration
End Sub
The name of the track is loaded immediately but the durationString takes 30 secs before it is loaded.
Any ideas why?
Thanks
John
After a bit more digging, this code does it
Player1.newMedia(Player1.URL).durationString
Loads the duration before the media has started playing
Related
hi its a catalogue application
I have 50 pictures on my folder but i want in the app load show 12 pictures in 12 picturebox
i use this code but it gives me nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 0 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile("C:\Dev\Images\TEST400.jpg")
Next i
End Sub
Help plz
Your image files should be saved as TEST1.jpg,TEST2.jpg, ......TEST12.jpg etc.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 1 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile(#"C:\Dev\Images\TEST" + i.ToString +".jpg")
Next i
End Sub
Note: I just wrote this code here only. Its not tested.
Facing a problem with new Windows Mobile project. I have created a DataSet and added DataSetTableAdapters. Added a query into it and tried to run it and everything worked well. However, when i tried to implement it to my code i get an error
No symbols are loaded for any call stack frame
Where can be a problem???
Here is a code sample:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim username As String
Dim kiekis As Integer
Dim EmpAdapter As DataSet1TableAdapters.EMPTableAdapter
EmpAdapter = New DataSet1TableAdapters.EMPTableAdapter
username = "Petr%"
kiekis = EmpAdapter.Kodas(SCANCODE:=username).Count
Label1.Text = kiekis.ToString()
''MsgBox(kiekis.ToString)
End Sub
And attaching snippet of error - could it be related to Symbol Status where i get error: Cannot find or open the PDB file?
I'm trying to build an app to run on top of IBM i (AS400). So far I can get the application to open and login, but I'm looking for a dynamic solution as opposed to using static send keys
Imports System.Threading
Public Class Form1
Dim a As New Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a.StartInfo.FileName = "C:\Program Files\reflection\default scripts\as400.rsf"
a.Start()
Thread.Sleep(3000)
SendKeys.SendWait("UserID {TAB}")
Thread.Sleep(1000)
SendKeys.SendWait("Password {Enter}")
End Sub
End Class
I can run a macro that will display a popup box where the password is entered
Sub Macro1()
'
' Generated by the Reflection Macro Recorder on 03-18-2015 13:03:31.50
' Generated by Reflection for IBM for Windows 8.00
'
With Session
Dim hostpassword As String
.WaitForEvent rcEnterPos, "30", "0", 6, 53
.WaitForDisplayString ".", "30", 6, 49
.TransmitANSI "USERID"
.TransmitTerminalKey rcIBMTabKey
hostpassword = "PASSWORD"
.TransmitANSI hostpassword
.TransmitTerminalKey rcIBMEnterKey
End With
End Sub
I can't just copy and paste that into visual studio and get it to work that way. So my question is how do I get a textbox to inject whatever is typed, into a command line of an external application? I've done a fair amount of research but most everything I've found doesn't apply to what I'm attempting as every tutorial I've found is geared towards MS Office, Excel mostly. Can someone please point me in the right direction?
See the Host Access Class Library Automation Objects.
Here is an example VB script I wrote years ago to reconnect sessions:
Option Explicit
Dim autECLConnList As Object
Dim i As Integer
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
autECLConnList.Refresh
If autECLConnList.Count > 0 Then
For i = 1 to autECLConnList.Count
If autECLConnList(i).CommStarted Then
autECLConnList(i).StopCommunication()
End If
autECLConnList(i).StartCommunication()
Next
End If
Thanks for the reply, however I'm not having any connection issues as the program opens and logs in just fine, I was just trying to figure out how to get text from my form into AS400 and I didn't realize the solution was this simple, I'm very surprised no one answered, or maybe they were waiting for me to figure it out on my own
Imports System.Threading
Public Class Form1
Dim a As New Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a.StartInfo.FileName = "C:\Program Files\reflection\default scripts\as400.rsf"
a.Start()
Thread.Sleep(1000)
SendKeys.SendWait(TextBox1.Text)
Thread.Sleep(1000)
SendKeys.SendWait("{TAB}")
Thread.Sleep(1000)
SendKeys.SendWait(TextBox2.Text)
Thread.Sleep(1000)
SendKeys.SendWait("{ENTER}")
End Sub
End Class
I'm writing a small program and I ran into a problem. I want to append text to RichTextBox every 1 Timer Tick. How can I do that?
Ok...handle the Tick() event of the Timer and append your text:
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
RichTextBox1.AppendText("Append: " & DateTime.Now & vbCrLf)
End Sub
When I use an OpenFileDialog, and select a file and click open etc, etc...
I want a label on the same form to automatically update with the directory path. At the moment I have this working, However the label updates on click, not automatically on the directory change.
CODE:
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
Label4.Text = OpenFileDialog2.FileName
End Sub
Cna I change the "Label4_Click" to something else for an auto update?
How are you displaying the OpenFileDialog? You need to update the Label from there!...
Something like:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If OpenFileDialog2.ShowDialog = Windows.Forms.DialogResult.OK Then
Label4.Text = OpenFileDialog2.FileName
End If
End Sub