|
Lets say that you have a form called Form1 and you want to check to see if it is open first so you dont have multiple instances of the form running around on your end user's desktop.
First we make a Class statement and define your Form1 as FormNumberOne with events:
Dim WithEvents FormNumberOne As Form = Form1
Then under an action like a menu item click or something we drop this if statement:
If FormNumberOne Is Nothing OrElse FormNumberOne.IsDisposed Then
Dim FormNumberOne As New Form
FormNumberOne = Form1
FormNumberOne.Show()
ElseIf FormNumberOne.Visible = False Then
FormNumberOne.Show()
Else
MsgBox("You already have the form number one open")
End If
Give this a try, should be what you are looking for...
|
|
|
|
|
I have a dataset containing 2 tables, PLSupplierAccount and PLProposedPayment, which contain related data. I have created a relationship between the two table.
I now need to execute the following sql statement, and return a single recordset/table of the data.
SELECT * FROM PLSupplierAccount INNER JOIN PLProposedPayment ON PLSupplierAccount.PLSupplierAccountID = PLProposedPayment.PLSupplierAccountID
Not sure how to do this, and Google[^]"> was not much help.
Any help appreciated (as always)
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Try this:
SELECT PLSupplierAccount.*,PLProposedPayment.*
FROM PLSupplierAccount INNER JOIN PLProposedPayment ON PLSupplierAccount.PLSupplierAccountID = PLProposedPayment.PLSupplierAccountID
But change PLSupplierAccount.*,PLProposedPayment.* for the columns you really need - its not good practice to do a select *, although I often use it for code examples
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Bob
Thanks for the reply, but it's not the SQL statement I am having trouble with. I need to return the data from a DataSet i.e. execute the select statement against the dataset and get the results as a single datatable.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Sorry, I misunderstood. Personally I would be tempted to requery the database and create the new table that way.
This may help, but I have not tried it myself. I'm kind of old fashioned, I like to let sql do the work for me whenever I can Microsoft Article
Bob
Ashfield Consultants Ltd
|
|
|
|
|
so you need to drop the combined dataset into an array, then loop through the array and assign each line to a pre-built internal data table?
|
|
|
|
|
Thats Microsoft's solution not mine I would requery the database and create the new table that way
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ideally I would also requery the database (and normally would), but in this case I need to load a subset of data from the database, make some changes to it and when the user is happy with the changes, submit them back.
Thanks for the help and advise
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
I failed to mention two wonderful classes that you can use to do what you want quickly, one is dataset and the other is dataview and they should not be overlooked because they can help you out.
Public Class DataView
Inherits System.ComponentModel.MarshalByValueComponent
Member of: System.Data
Summary:
Represents a databindable, customized view of a System.Data.DataTable for sorting, filtering, searching, editing, and navigation.
Public Class DataSet
Inherits System.ComponentModel.MarshalByValueComponent
Member of: System.Data
Summary:
Represents an in-memory cache of data.
|
|
|
|
|
That was (or still is) the problem, Steve has a dataset with 2 datatables that he wants to query with a join. There is no real support within the dataset/datatable/datarelation world to do this easily.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Lets see if I can think this through ...
We point / read a dataset (call it dsOne) to a table from your SQL? server.
We point / read a second dataset (call it dsTwo) to another table from your SQL server.
We point a dataview (call it dvOne) to dsOne
We do a sort on dvOne on PLSupplierAccountID
We pull the first entry for PLSupplierAccountID in dvOne
We point a second dataview (call it dvTwo) to dsTwo
We use the entry from dv.One SupplierAccountID to do a dvtwo.Find
If we get a match we combine the row entry from dvOne with dvTwo in a DataGrid
Once you get all the matches combined in the datagrid, you can make your changes using your form.
These changes will be stored on the form until you "submit" them back to your SQL server using a update query.
This sound about right to you?
|
|
|
|
|
Sometimes life's a bitch.....
Just a thought, would linq help? I have only played with it briefly, but it might be worth a look?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I've not even had time to look at LINQ, but I think I will make the time.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Looks interesting! I will have to play with this!
|
|
|
|
|
Hi,
we have a strange problem. A VB.net 2005 (.net 2.0) application runs on many WinXP clients and accesses a central DB (MaxDB 7.5.0.26, it's an open source DB by SAP) on a server. It works fine for all clients except for one of them. By the help of a profiler we found out on this client that every call of the VB command "myOdbcConnection.Close" needs about 2 seconds, which completely slows down the application (it only opens the connection when needed and afterwards closes it right away, which works fine on all the other clients). (The odbc driver is MaxDB 7.5.0.26.)
The client runs on WinXP SP3, the same problem occurs if SP3 is deinstalled and only SP2 is avaiable. We also deactivated the anti virus program ("F-secure") and the firewall - problem remains the same. Not only .net 2.0 (2.0.50727) is installed on the client but also .net 3.0 (need by another program). We deinstalled .net 3.0 - problem remains the same. ("Shared Add-in Extendability Update for Microsoft .NET Framework 2.0" and "Shared Add-in Support Update for Microsoft .NET Framework 2.0" are also installed on the client.) -- That is, we do not have any idea anymore what we could check ...
What could be wrong with the client? What should we have a closer look at?
Thanks in advance for help.
Kind regards,
Michael
|
|
|
|
|
I would check the versions of the odbc dll's between the problem machine and a good one. That has caught me out in the past.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
"Unfortunately" the files belonging to the ODBC driver are identical between the "bad" and a "good" client.
Michael
|
|
|
|
|
i have a program that works fine. i created a window service that work. when i copied the code to the winservice. a triger timer enable in the onstart method triger a call to the method processmail.
if i start the service from window manage. i reicieve the error" the myservice in local computer started and stopped. some services stop automatically. if the have no work to do for example the performance logs and alert service.
when i start it from vs ide "could not perform the requested operation for service on machine plp11"
can someone over help
|
|
|
|
|
Ebube wrote: when i start it from vs ide "could not perform the requested operation for service on machine plp11"
You cannot run a service from the ide. In the onstart event of the service put a thread sleep to allow you time to connect from the ide (DEBUG>ATTACH TO PROCESS) This may give you some clue as to what is happening
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
Does anyone know the download site of the tool Spy++?
Thanks,
Andy
|
|
|
|
|
No, it comes as part of the VS intallation, but a quick google shows there are many similar tools available FOC
Bob
Ashfield Consultants Ltd
|
|
|
|
|
when we are in pop up window ,i don't want any action to take place unless i have closed the pop up window and back to the master page. How to do that?
|
|
|
|
|
|
Stop posting the same question over and over in multiple forums. If you learned to explain yourself someone would answer your question. As you have posted this in VB and ASP forums are you writing a windows application or a web based one. If its a windows app then FORM.ShowDialog() will do it, but PLEASE stop posting the same useless question over and over!!!!!!!!!!!!!!!!!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
when we are in pop up window ,i don't want any action to take place unless i have closed the pop up window and back to tye master page. How to do that?
|
|
|
|