|
I've never gone through the MCI API functions, but it looks like you can probably get away with using the MCI Command STATUS WAVEAUDIO LENGTH to get the length of the media file. Use that as the maximum value for the TrackBar. You'll probably have to do some translating to get the time returned by STATUS into a more usable format, like converting the total time to total seconds.
In order to get the current position of the playback, you'll need to setup a timer and poll for the position status using the STATUS WAVEAUDIO POSITION command. This too will be returns in a time format. Convert it to seconds as before and you can use that to update the position of the TrackBar.
Same thing with seeking with the TrackBar. Convert the number of seconds returned by the position of the TrackBar into the appropriate time format, then use the SEEK WAVEAUDIO TO POSITION command to control where in the file to resume playing.
Sorry, I don't have any example code, 'cause liek I said, never played with it before.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave
Dnt wanna be a pain but I was wondering if you can give me a vb.net example of what you mean tat way I can understand it better
|
|
|
|
|
Hi David
What Ive managed to is. Thiis at the moment does nothing but when I fiddle with the trackBar a little noice disturbance is caused....
TrackBar1.Maximum = 100
TrackBar1.Minimum = 0
TrackBar1.TickFrequency = (mciSendString("Play Med", 0, 0, 0))
|
|
|
|
|
Well, I don't have any. I can't wip anything up in the near future either, because I don't have Visual Studio .NET here at work (not allowed to install it anywhere!), and I won't be home until the wee hours of Friday morning.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave
Ive been looking at sum vb code this is what i got. No if Im not mistaken the below method allows u to play anyt part of the wav file? if im not mistaken. if the code is correct then what parts would I need to change soo that I can use it in my trackBar.
Any position within a WAV can be set by using the seek command. This also sets the position of the WAV for PLAY. The example below sets the WAV starting position to 1000 (milliseconds).
i = mciSendString("seek voice1 to 1000", 0&, 0, 0)
|
|
|
|
|
Like I said, I've never played with MCI stuff, so I can't tell you if this is going to work or not. It's trial and error...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please some can tell me how to start a process when the windows starts.Well some one told me that we can do it by making some changes in win.ini files but there is no such thing in win.ini file. So can anyone help me in this problem.
|
|
|
|
|
If you want a application to start on Windows startup, then write your application as a Service. If you want it to start when a user logs in, then a normall application can be written and launched from the Registry's Run key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have this combo box populated with data column selected from access table, let's say it contains Employee id, "E001", "E002", "E003"
Now i need to pass the selected value in this combo box to a text box.
i.e. selected value in combo box is "E001" then textbox shows "E001"
|
|
|
|
|
Put this in the Combobox1 text changed area
textbox1.text=combobox1.text
duh
James Kennelly
|
|
|
|
|
OMG such a short code... i figure this out for hourss....
Anw Thanks for the reply James
|
|
|
|
|
Hi,
I have a navigation form worikng fine with add, update and so on...
I'm lost trying to insert a listview control so I can list child itens to the current item on my form.
Ex: hotel - hotel rooms - hotel room prices
I would like to list the hotel rooms related to my hotel (which is on my form already) and this list to also navigate as I click on my next and previous buttons for the Hotel record, then I would have a list its subitens on it.
Any ideas?
Thanks
|
|
|
|
|
Every time the Hotel information changes, you'll use the primary key ID of the Hotel record to search the database for the Hotel Rooms related to the key. Return those rooms in a table, then bind the ListBox to the datatable.
Sorry, I can't be more specific about how to accomplish this. You haven't given any details at all on how your doing what you've got so far and the controls your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to create a slash screen in vb.net?
I tried to look for so many information of creating slash screen, but most of them are using in vb 6.0 or under. It doesn't work in vb.net.
Lisa
|
|
|
|
|
Lisa,
Just create a regular form in VB.NET , typically you would change it's properties so it does not show a title bar or controlbox. Set the form as the startup object and have it call your application initialization code. If the initialization succeeds, have the form launch the main application form and then close itself. Or you can have the main application form initially hidden, then have the main application form show a splash screen. The second approach is a little easier to code in NET.
Although I think having a splash screen is still part of the overall presentation of an application, unfortunately much of the point of having a splash screen in the first place is to minimize the user's perception of startup time. This is compromised in NET because the framework itself has to load before you can even show a splash screen and in many cases the framework loading will represent a good percentage or even the majority of your start up time.
Robert
|
|
|
|
|
Thanks Robert.
How can I code the initializtion succeeds?
Private Sub frmSlash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim main As New frmMain
Dim slash As New frmSlash
slash.Show()
main.Hide()
'if the time > 2 second then ??how to code the condition??
'I want it to show up the main form after 2 second the slash form load
main.show()
slash.hide()
End Sub
Lisa
|
|
|
|
|
Create a module and use this code. Make sure you set the module as the startup program
Imports System.Threading
Module startmod
Dim threadsplash As Thread
Dim frmsplash As Form
Public Sub main()
frmsplash = New Splash
With frmsplash
.Show()
.Refresh()
End With
threadsplash = New Thread(AddressOf hidesplash)
threadsplash.Start()
Dim Form1 As New Form1
Application.Run(Form1)
End Sub
Private Sub hidesplash()
frmsplash.Opacity = 1
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.9
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.8
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.7
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.6
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.5
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.4
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.3
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Refresh()
frmsplash.Close()
End Sub
End Module
James Kennelly
|
|
|
|
|
|
A little simpler alternative is:
Sub Main:
Module modMain
Public Sub Main()
Dim frmMain As New frmMDIMain()
Dim frmSplash As New SplashScreen()
Dim fStart As Boolean = False
'Show the splash screen
frmSplash.Show()
'Run start up code in splash screen
fStart = frmSplash.RunInitialization
'Close the splash screen
frmSplash.Close()
'If startup was successful launch frmMain
If fStart Then
Application.Run(frmMain)
End If
End Sub
End Module
SplashScreen code
-------------------------------------------------------------------------------------------
Public Class SplashScreen
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
...
#End Region
Private m_fTimeout As Boolean
Public Function RunInitialization() As Boolean
'Enable wait timer
Me.tmrWait.Enabled = True
Dim fStart As Boolean = False
'Run your main Startup code wrapper function here
fStart = RunMyAppStartup()
'Process messages in wait loop until wait timer expires
'Don't care about performance hit of DoEvents for wait timer
While Not m_fTimeout
Application.DoEvents()
End While
'Return value of startup success to Sub Main()
Return fStart
End Function
Private Function RunMyAppStartup() As Boolean
'Your application startup function calls go here
'Just return True for example
Return True
End Function
Private Sub tmrWait_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrWait.Tick
Me.tmrWait.Enabled = False
'Set timeout flag to True
m_fTimeout = True
End Sub
Private Sub InitializeControls()
Me.lblVersion.Text = "Version: " & CURRENT_VERSION
Me.lblTitle.Text = Application.ProductName
End Sub
End Class
|
|
|
|
|
Ive been having this problem with a access database im writing. Im trying to use a form to query data from a table based off whats in a certain box on the form and putting it into word using mailmerge. Ive got the code down for the query and it works but heres the code im having trouble with.
Private Sub Command2_Click()
Dim objWord As Word.Document
Set objWord = GetObject("C:\QA\RB.doc", "Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\QA\QA.mdb", _
LinkToSource:=True, _
Connection:="QUERY test", _
SQLStatement:="SELECT * FROM test"
objWord.MailMerge.Execute
End Sub
The problem is that it opens the database again and i dont want it to i want it to get the information from the currently open database
Thanks
Nathan
|
|
|
|
|
It's doing exactly what you told it to. The OpenDataSource method you called will open the database using it's own connection, not yours. This should be no surprise considering you never gave (or even get the opportunity) to pass in an externally generated connection object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know that but how could i rewrite it to not do that. Im still kinda learning access VB.
Thanks for any help.
|
|
|
|
|
That's just it, you can't! There is no method provided by the MailMerge object that will allow you to supply a previously prepared connection object. MailMerge will always create and use it's own connection.
Why is this an issue anyway?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well what im trying to do is:
I need to create a mutipage report with different things on each page. So i figured i would use mailmerge but then i also need to be able to have the user pull a record of choice to be displayed in word for this mail merge. Which i have been able to accomplish the only problem was with opening the database and pulling the data i need from a form. Thanks for the help at least now i know its not possible. Do you have any idea on what would be a way to do this without mailmerge. Thanks again for your time.
Nathan
|
|
|
|
|
Well what im trying to do is:
I need to create a mutipage report with different things on each page. So i figured i would use mailmerge but then i also need to be able to have the user pull a record of choice to be displayed in word for this mail merge. Which i have been able to accomplish the only problem was with opening the database and pulling the data i need from a form. Thanks for the help at least now i know its not possible. Do you have any idea on what would be a way to do this without mailmerge. Thanks again for your time.
|
|
|
|