|
The VB version is:
Dim arrayname(length) as integer
and
you have to be more specific with that
|
|
|
|
|
You're coming to VB from C++, and the main problem is you don't understand OO ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
You can use the method (Application.Exit()):
type
System.Windows.Forms.Application.Exit()
or
Application.Exit()):
which is the same.
|
|
|
|
|
Hello,
I have been working on an application, however, I am unable to stop my application until Windows Media Player starts playing a file. Here's my code:
(As a side note, the variable "i" is an integer, and the LSTFiles is a listbox that contains a list to a number of files)
For i = 0 To LSTFiles.Items.Count - 1
If LSTFiles.Items.Item(i) <> wmp1.URL Then wmp1.URL = LSTFiles.Items.Item(i)
If isReady = True Then
Dim newentry As String
newentry = newline + DTPDate.Value + vbTab + vbTab + wmp1.currentMedia.duration.ToString + vbTab + ComboBox1.Text + vbTab + ComboBox2.Text
isReady = False
completelog += newentry
Else
i = i - 1
End If
Next
isReady is a boolean variable that is in the declarations part of my form. My event handler that changes isReady is:
Private Sub wmp1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles wmp1.PlayStateChange
If wmp1.playState = WMPLib.WMPPlayState.wmppsPlaying Then isReady = True
End Sub
My For Loop should keep on repeating until the isReady = True and then record the data to the currentlog (a string). However, the loop seems to keep on going forever, and eventually I have to press the stop button on the VB .Net IDE.
Can anyone please help me?
Thanks,
Programmer2k4
My sig:
"The so-called 'Bugs' do not exist, they are merely features hidden by developers with message boxes that say 'An unhandled exception has occurred'." - Programmer2k4
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
I now use my CodeProject Blog!
|
|
|
|
|
Have you used the break points to see what's going on?
|
|
|
|
|
Hello,
It seems to get stuck on the loop when I keep on telling it to i = i - 1 . (I think the loop keeps on going, and my event handler isn't ever triggered due to my loop pausing/stopping my application)
Is it possible to find a different way to pause the loop until the PlayState changes?
Thanks,
Programmer2k4
My sig:
"The so-called 'Bugs' do not exist, they are merely features hidden by developers with message boxes that say 'An unhandled exception has occurred'." - Programmer2k4
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
I now use my CodeProject Blog!
|
|
|
|
|
You can use a thread
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Something as Threading.Thread
Something= New Threading.Thread (Addressof Myfunction)
Something.Start
End Sub
Private Sub MyFunction ()
'Put here your For / Next
'And you can pause the thread by doing something like this
Something.sleep(5000)
End Sub
|
|
|
|
|
Thank you for the help, it works great now!
Thanks,
Programmer2k4
My sig:
"The so-called 'Bugs' do not exist, they are merely features hidden by developers with message boxes that say 'An unhandled exception has occurred'." - Programmer2k4
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
I now use my CodeProject Blog!
|
|
|
|
|
Hey everyone ~
This is my first post here and I hope someone can help me. I am trying to call my application that is already running in the system tray with a shortcut when it does not have the focus. I've thought about using a keyboard listener but there has to be a different and easier way to do this. Maybe it could be done by using a desktop shortcut to load another copy of the program but check to see if its already running and give that application the focus. If that makes any sense.
Another question that has nothing to do with the first one is how do you maximize your application if your have a dual monitor setup. There is a built in button that gets applied to your form if you have an ATI video card but I have no idea on how to call that if thats possible at all. But that then leaves everyone else out of luck that doesn't have that card.
If anyone can help me i would greatly appreciate it. Thanks in advance.
FuzMan ~
|
|
|
|
|
Sorry Everyone ~
Forgot to tell you I am using VB.NET 2003. With the newest Framework installed. Thanks again.
FuzMan ~
|
|
|
|
|
I'd like to know how to do this as well.
Anyone have an answer/suggestion?
|
|
|
|
|
I am trying to intercept calls to the SaveAs and FileOpen dialog boxes in notepad and wordpad. In other words when I click File->Open I want my own window to popup instead the usual dialog box.
I am a beginner to intermediate programmer and have looke at Hooks expecialy the SysMsgProc function but this is a little over my head. I would appreciate any help and source code that can be supplied.
Thanks
HD
|
|
|
|
|
Not possible. In Word it is because the Word object model fires off an event signaling an applicaiton that these dialogs are about to be shown. But, Notepad and Wordpad don't have object models, let alone fire off any event before a dialog is shown.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hy everyone!
Is there a chance to get the language of the Word programm?
Because I do want to do the following:
If it is english then set constants to the english version, if it is German then set it to the german version etc.
So I wonder if there is an easy way to get the language to set the constants correctly! So I would be interested what this has to look like in VBA for Word and where it is stored there!
Thanks!
Stephan.
|
|
|
|
|
Word will use the current Regional and Language Options settings, which in VB.NET, is can be had from the Application.CurrentCulture[^] property.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well as you can see i am a newbie at VB.net :->
I try learning to code, by using some code samples.
However in some msdn sample, it says add the "common dialog control"
on screen i have all kind of controls under the on the left side 'under the label: window forms. I also checked under: menu > projects > where one can add various things but my wanted 'common dialog control' is in none of them ... ??? (must it perhaps be added??) ??
I had a book also but it is not explaining me where to find this in the gui.
Answer must be easy i believe it's often used, but i cannt find it.
jipiee i'm on vb
|
|
|
|
|
In VB6 You could add the common dialog control.
In vb.Net the common dialog control is divided in several controls thar are on the left side of the vs ide called the toolbox.
Yoou have the openfiledialog, the savefiledialog, etc...
All this are part of the all in one common dialog control.
|
|
|
|
|
hi, i want the treeview to be right to left, i use VB6.0 i need code pleeeeeeeeeeeeeeeeeeeeeeeeeeease
Thanks alot
Hamody
|
|
|
|
|
The TreeView control doesn't have proper support for RtL. If you use the properties of the control, the tree is still drawn left to right, but the text of the nodes is right to left.
If you use the "mirror" method to flip a left drawn treeview over to the right, all the tree icons are also reversed.
Your best bet would be to search the web for a replacement TreeView control that implements proper support for RTL. They're all over the place, seemingly everyone sells one.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hallo everybody,,,!
Please anybody if can help me...!
I have problem with my login user code ..,
If the user type the wrong password the messagebox couldn't appear "Pasword does not match with username", but the messagebox appeared is "Username does not exist" asa same as we type the wrong username.
THe code is written below :
Dim ds As New DataSet<br />
Dim dt As DataTable<br />
Dim dr As DataRow<br />
Dim username As String = Me.txtUserName.Text<br />
Dim password As String = Me.txtPassword.Text<br />
Dim strSql As String = "SELECT * FROM users where username='" + username + "' and password='" + password + "'"<br />
Dim oleConn As New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=data\persedkont.mdb")<br />
Dim oleDa As New OleDb.OleDbDataAdapter(strSql, oleConn)<br />
oleDa.Fill(ds)<br />
dt = ds.Tables(0)<br />
If (dt.Rows.Count = 0) Then<br />
MessageBox.Show(username + " does not exists!", "Login Fail", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
Else<br />
dr = dt.Rows(0)<br />
Dim pass As String = dr(2).ToString<br />
Dim userId As String = dr(1).ToString<br />
If (dt.Rows.Count = 0) And password <> pass Then<br />
MessageBox.Show("Password does not match with username.", "Login Fail", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
Me.clearForm()<br />
Else<br />
If password = pass Then<br />
Me.clearForm()<br />
Me.Close()<br />
End If<br />
End If<br />
End If<br />
'MessageBox.Show(strSql)<br />
Try<br />
Catch ex As Exception<br />
MessageBox.Show("Wrong UserId or Password")<br />
End Try
Thank's verymuch for help.
Best Regards,
Ahmad Rifai Yusuf
|
|
|
|
|
hi man i dont know, u can make a select statement to select justonly the password of the entered user name, and then compare it with the entered password ..... if doesnt match give the message box with a sentence u want ......
Thanks alot
Hamody
|
|
|
|
|
HAve u checked whether the table has any rows in it
because the Message box should pop only when the table rows are 0
and also when you are executing the fill method of dataadpater also aspecify the TAble name and use the table insted of index while retrieving the populated table
I think this should answer all your queries
Mandar Patankar
MCP
|
|
|
|
|
Hi, I wanna help you handling...
so for username adn password i will show u my idea (maybe easy one)
If me.txtUserName.Text<>"john" Then
msgbox("the user " & me.txtUserName.Text & "doesnt exist")
ElseIf me.txtPasswor.Text<>"kenedy" Then
msgbox("password incorrect")
EndIf
this is a simple code for username and password for login without using DB
|
|
|
|
|
I want to know that how to write a module in VB.NET.
Actually in my project, below is the code which is used in 15 forms. If i make a module of this code and call it in every form, then it will be a good technique
Here is the code
=============
Dim cm As New SqlClient.SqlCommand
Dim cn As New SqlClient.SqlConnection
cn.ConnectionString = "data source=abc; initial catalog=books; user id= sa; password=sa;"
cn.Open()
cm.Connection = cn
cm.CommandText = "select * from info"
cm.CommandType = CommandType.Text
please tell me that to write a module, and how to call that module in a form.
Please solve my this problem.
Regards,
Eshban
EsHbAn BaHaDuR
|
|
|
|
|
Hello,
Right click your project and then click on Add->Add Module. Give the module any name.
Create a Function within the module, such as: (in this case, I named my Module "Functions" and my Function "Test()". I used the code you provided just for an example. You can name the Module and the Function differently. Here is the complete module)
Module Functions
Function test()
Dim cm As New SqlClient.SqlCommand
Dim cn As New SqlClient.SqlConnection
cn.ConnectionString = "data source=abc; initial catalog=books; user id= sa; password=sa;"
cn.Open()
cm.Connection = cn
cm.CommandText = "select * from info"
cm.CommandType = CommandType.Text
End Function
End Module
To call the function, all that you need to do is use the function name that you put it under. In my case, I would use test() wherever I needed the code to be executed.
I hope this solves your problem ,
Programmer2k4
My sig:
"The so-called 'Bugs' do not exist, they are merely features hidden by developers with message boxes that say 'An unhandled exception has occurred'." - Programmer2k4
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
I now use my CodeProject Blog!
|
|
|
|