|
Dave You are the sh*t (positif ofcourse)
Maybe for the people who browse to do the same with a datagridview :
If DataGridView1.SelectedRows.Count = 0 Then
RaiseEvent CustomerSelected(DataGridView1.Item(columnindex, rowindex).Value.ToString())
End If
Or something...
Dave is there is anything i can do 4 you just mail me on facebook (already send you a message)
Succes with everything and greetings from belgium
|
|
|
|
|
Dave,
Can you tell me what changes if i want to send my values to destination form?(using events)?
Before it was form 1 opens form2 you select a value and send back to form1 close form2
now i want form1 opens form2 and sends the values immediantly.
Can you provide my info about the change in code?
Thx in advance agian
greetz
|
|
|
|
|
You have all the information about events in the message I previously posted.
Providing your Form1 has subscribed to the events of form1, you can raise the event on Form2 from anywhere you want within Form2.
Cheers,
Dave
|
|
|
|
|
hmm Dave i'm not that good that i can apply your last comment into my project...
I searched whole day like crazy:
Your example:
Public Class FormMain
Private WithEvents selectKlant As FormCustomerLookup = Nothing
Private Sub ButtonLookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLookup.Click
selectKlant = New FormCustomerLookup
selectKlant.Show()
End Sub
Private Sub selectForm_CustomerSelected(ByVal item As String) Handles selectKlant.CustomerSelected
TextSelectedCustomer.Text = item
selectKlant.Close()
End Sub
End Class
Public Class FormCustomerLookup
Public Event CustomerSelected(ByVal item As String)
Private Sub ButtonSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelect.Click
If DataGridView1.SelectedRows.Count = 0 Then
RaiseEvent CustomerSelected(DataGridView1.Item(2, 1).Value.ToString())
End If
End Sub
End Class
I just want to change your givin example.
So actually i start on formcustomerlookup and before i raise my event i want to open "formmain" and fill the textbox with the value.
do i have to switch the with event or??because i cannot move the
selectKlant = New FormCustomerLookup
selectKlant.Show()
Greetz Dave and hoping 4 some patience again...
|
|
|
|
|
There are two ways of looking at this situation:
1. mdiChildA creates the instance of mdiChildB so it can hold a reference to it.
2. mdiParent holds the children so it has a reference to all of them.
I prefer number 2 and when creating mdiChildB I would make mdiChildA raise an event that mdiParent responds to and creates mdiChildB .
All communication from the children I do by events to the mdiParent . The parent can then call methods/set properties in any other children that need to respond to events raised by others.
|
|
|
|
|
Hello All,
I am stuck with this problem and could sure use a hand. I am trying to open MS Project 2007 and connect to MS Project Server 2007 based on windows authentication all from either Excel 2007 or 2010.
Everything works fine on both versions of Excel if its running on a Windows XP machine. The problem occurs when I attempt to run the code in a Windows 7 machine with Excel 2010.
When the code gets to the Shell function, where it attempts to open MS Project 2007 and connect to MS Project Server 2007, the Error 53 message appears, file not found and that only on one machine, my bosses.
I've tried it on other similar machines and it runs well.(Win7 / Excel 2010)
On my bosses machine, I take the value that passes through the Shell function and paste it in the run command and it does what it should, opens and connects to MS Project Server.
Can anyone shed some light on this?
sServer = "http://xxx-xxx/XXX"
sServerString = "winproj.exe /s """ & sServer
Shell sServerString
I've already set the object before this, if it matters...
Set oP = GetObject(, "msproject.application")
Thanks in advance.
|
|
|
|
|
The first thing to try would be to put the full path and file name to winproj in the string. If that works then the problem lies in the OS not knowing where it resides.
sServerString = "C:\somefolder\subfolder\winproj.exe /s " & sServer
You could add a the path to Environment variables PATH statement
|
|
|
|
|
Hey Dave,
Thanks! Your suggestion led me to keep digging and it turns out that the Shell function was looking for winproj.exe in the Office14 folder and not the Office12 folder. The user has Office 2010, but MS Project 2007.
I went ahead and added the path for him. When i have time, which i dont I'll add some code to check for the version and determine what path to create or simply check for the existence of the file and folder....
Thanks again...
|
|
|
|
|
Glad you got there in the end
|
|
|
|
|
hi
i am a new user of vb and i would like to know how i can connect mysql database with my vb6.0 project. is there is connector setup will be there than how i can get this and how i will use that.
thanks
Regards
Umesh Chand Daiya
I will do my best?
The Web Soluution, Bikaner (Raj.), India
|
|
|
|
|
To connect MySQL to VB 6 you need to download the OBDC Driver for MySQL Here[^] although I would seriously recommend that you download Visual Basic Express 2010[^] and start your project with VB.Net. VB 6 was discontinued at least 6/7/8 years ago and is no longer supported. It would be much easier for you to find tutorials and stuff related to VB.Net these days, and would serve you in much greater stead. Good Luck whichever way you go.
Live for today. Plan for tomorrow. Party tonight!
|
|
|
|
|
No. Even before VB6 was launched ODBC was a deprecated technology. He should use ADO.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Firstly, don't use VB6 unless someone is putting a gun to your head; even then think hard about the choice.
Secondly, use ADO not ODBC. You will need to download the MDAC library from Microsoft, I assume it is still available. You need at least 2.5 but later versions may still work.
The better option is to go with .net.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
|
Hello !
have a form on vb.net bounded with a bindingsource on entity framework.
when the form is closed , should i dispose entity or bindingsource?
|
|
|
|
|
Rule of thumb: If the object has a Dispose method, call it before the object goes out of scope.
|
|
|
|
|
My request is for a specific situation :
Entity framework created directly from existing database (sql server), A form with a bindingsource.
When the form is open the code is :
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim f As unEntities
f = New unEntities
FaBindingSource.DataSource = f.fas
End Sub
What can i put on :
Private Sub Form1_FormClosed(sender As System.Object, e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
f.dispose ????????????????
FaBindingsource.dispose ??????
FaBindingsource.clear() ??????????
or ????????
End Sub
Thank you
|
|
|
|
|
I highly suggest you pick up and work through a book on C#.
Since f is declared in the Load event handler method, it cannot be seen outside of that method. Trying to do a f.Dipose() anywhere else will cause the compiler to throw an error at you.
Next, no, you don't have to Dispose a BindingSource, even though it has a Dispose method.
|
|
|
|
|
ok maybe my question is wrong . The real situation is :
i have a form with select buttons that i use to move through records.I select for example the third record and after that i close the form.If a reopen the form , the third record is selected.i don't want this situation.When the form is loaded , the first record should be selected.I know that i can put something like moveToFirst method , but i dont want this.I try to put bindingsource.dispose on closing form sub , and this has not resolved the problem.if i put bindingsource.clear() the problem is resolved.
So i just want to understand the situation , after the form is closed the bindingsource keeps the records ??
Anyway , thank you !
|
|
|
|
|
Disposing the thing doesn't have anything to do with this. It sounds as though your problem is that once you dismiss the form, you're reusing it instead of destroying it and creating a new instance of the form. But, you haven't said much about your application of what this form is for so it's pretty difficult to tell you where you're going wrong.
|
|
|
|
|
i have a menu on my application.And the code in menu item to open this form is :
form1.showdialog
After the form is closed using x button
|
|
|
|
|
OK, so after the .ShowDialog call, do what you need to do with the data on the form and .Dispose it. Then in the menu click code you can create a new instance of the form like it never existed before in the first place.
|
|
|
|
|
ok.
but should i call form1.dispose(true) or form1.dispose(false) ?
|
|
|
|
|
Neither.
You've never shown a dialog form before, have you?
|
|
|
|
|
As Dave said.
unless you didn't create, or cause the creation, of the object (as in Brushes.Black ).
|
|
|
|