
Mykre
Avatar/Signature-
Posts
70 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Mykre
-
You can use a Data grid with a Data Set and not connecting it to a database, I do this and Once finished precessing I then Export it to variuos different formats depending on what the client wants, ie Tab or CSV, Excel, Access DB(Created at Runtime), or Push it to a crystal report.
-
Accessing form controls within a private shared sub
Mykre replied to PatRoy's topic in Windows Forms
What Language are you using... You could try Raising an event in your socket code and then on the form class catch the event. -
Have a look at WMI, remember to add the system.management.dll as a referance to your project. With WMI You can get information on any part of the machine and what is running on it, and with the correct permissions you can do this on remote machines as well.
-
Have a look at embedding resources on MSDN, or google. What you will have to do is add the file to the project, then go to the properties on the file in the solution explorer. There you will have to change the build action to embedded resource. At the moment I do not have any sample code that I can post but if you google the above you will find some.
-
Or This Uses SQL-DMO Public Class clsSQLDMO Public Function GetListOfSQLServers(ByRef colSQLServers As Collection) As Boolean Dim iIndex As Integer Dim oSQLServer As New SQLDMO.SQLServer Dim oServerList As SQLDMO.NameList = oSQLServer.Application.ListAvailableSQLServers colSQLServers = New Collection For iIndex = 1 To oServerList.Count colSQLServers.Add(oServerList.Item(iIndex).ToString) Next Return True End Function End Class
-
Try This, Uses the Net API Public Class clsNetAPI32 Private Const SV_TYPE_SQLSERVER = &H4S ' NetServerEnum Return Values Private Const ERR_SUCCESS = 0 Private Const ERROR_MORE_DATA As Int32 = 234 Private Const ERROR_NO_BROWSER_SERVERS_FOUND As Int32 = 6118I Private Structure SERVER_INFO_100 Dim sv100_platform_id As Integer Dim sv100_name As Integer End Structure ' ' level : Specifies the information level of the data ' bufptr : Pointer to the buffer that receives the data ' prefmaxlen : Specifies the preferred maximum length of returned data, in bytes ' entriesread : Pointer to a value that receives the count of elements actually enumerated ' totalentries : Pointer to a value that receives the total number of visible servers and workstations on the network ' servertype : Specifies a value that filters the server entries to return from the enumeration ' domain : Pointer to a constant string that specifies the name of the domain for which a list of servers is to be returned ' resume_handle : Reserved; must be set to zero Private Declare Unicode Function NetServerEnum Lib "netapi32" _ (ByVal servername As IntPtr _ , ByVal level As Integer _ , ByRef bufptr As IntPtr _ , ByVal prefmaxlen As Integer _ , ByRef entriesread As Integer _ , ByRef totalentries As Integer _ , ByVal servertype As Integer _ , ByVal domain As IntPtr _ , ByVal resume_handle As Integer _ ) As Integer Private Declare Function NetApiBufferFree Lib "netapi32" _ (ByVal BufPtr As IntPtr) As Integer Public Function GetListOfServers(ByRef colSQLServers As Collection) As Boolean Dim sServerName As IntPtr = IntPtr.Zero Dim iLevel As Integer = 100 Dim lBufPtr As IntPtr Dim iprefMaxLen As Integer = -1 Dim iEntriesRead As Integer Dim iTotalEntries As Integer Dim sDomain As IntPtr = IntPtr.Zero Dim iResumeHandle As Integer = 0 Dim iReturnValue As Integer Dim sctSrvList As SERVER_INFO_100 Dim nStructSize As Integer = Marshal.SizeOf(sctSrvList) Dim scSQLServers As New Specialized.StringCollection Dim iIndex As Integer colSQLServers = New Collection iReturnValue = NetServerEnum(sServerName _ , iLevel _ , lBufPtr _ , iprefMaxLen _ , iEntriesRead _ , iTotalEntries _ , SV_TYPE_SQLSERVER _ , sDomain _ , iResumeHandle _ ) If iReturnValue = ERR_SUCCESS Then ' Loop through each SQL Server returned by the NetServerEnum call For iIndex = 0 To iEntriesRead - 1 ' Convert each SQL Server entry into a SERVER_INFO_100 structure sctSrvList = DirectCast(Marshal.PtrToStructure(New IntPtr(lBufPtr.ToInt32 + (nStructSize * iIndex)) _ , GetType(SERVER_INFO_100) _ ) _ , SERVER_INFO_100 _ ) ' Add each SQL Server SERVER_INFO_100 structure entry into the StringCollection scSQLServers.Add(Marshal.PtrToStringUni(New IntPtr(sctSrvList.sv100_name))) Next End If ' Clean up regardless of iReturnValue Call NetApiBufferFree(lBufPtr) ' Move from String Collection to Array To Collection ' I only return the list as a collection because ' collections are what I am used to Dim sSQLServers(scSQLServers.Count - 1) As String scSQLServers.CopyTo(sSQLServers, 0) For iIndex = 0 To sSQLServers.GetUpperBound(0) colSQLServers.Add(sSQLServers(iIndex)) Next Return True End Function End Class
-
There is a couple of articles on Code Project that create fax documents as well as faxing them.
-
Try WMI it will make it easier to get to remote machines, pluse you can get a lot more information on the Machines. Remember to add a referance to the System.management.dll to your project... Imports System.Management Module Module1 Sub Main() Dim query As ManagementObjectSearcher Dim queryCollection As ManagementObjectCollection Dim co As ConnectionOptions Dim oq As System.Management.ObjectQuery Dim ms As System.Management.ManagementScope Dim mo As ManagementObject Dim strComputerName, strQuery As String Console.WriteLine("WMI List Services and there State") strQuery = "SELECT * FROM Win32_Service" ' Ask for a computer name Do Console.Write("Please enter server name (type 'localhost' for local machine): ") strComputerName = Console.ReadLine() Loop Until strComputerName <> "" ' Connect to the remote computer co = New ConnectionOptions If (strComputerName.Trim().Length = 0) Then Console.WriteLine("Must enter machine IP address or name.") Else ' Point to machine ms = New System.Management.ManagementScope("\\" + strComputerName + "\root\cimv2", co) ' Query remote computer across the connection oq = New System.Management.ObjectQuery(strQuery) query = New ManagementObjectSearcher(ms, oq) Try queryCollection = query.Get() Catch e1 As Exception Console.WriteLine("Error: " + e1.ToString()) End Try For Each mo In queryCollection ' create child node for operating system Console.WriteLine(mo("Name").ToString() + " [" + mo("StartMode").ToString() + "]") Next Console.ReadLine() End If End Sub End Module
-
With each MS Setup program there is a way to force the setup proggy to display the logs for the install. First Off I would run the install with the logs running. It could be as simple as not enough permissions to install to cirtain directories. If you are only a powewr user on that machine try upping the permissions to Administrator on the local machine and install again. If you have run the logs and are still having problems send the setup loggs to here and I will look at them for you to give you a heads up... Description of DirectX Setup Error Codes http://support.microsoft.com/default.aspx?scid=kb;en-us;177430 Windows Installer Logging http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/windows_installer_logging.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/wilogutl_exe.asp
-
If it is just a basic interactive program in Cartoon Style (Cell Graphics like XIII on the Xbox, or like the flash samples going around the net), I think the DirectX would be overkill. Now I meant graphics like XIII and not a game like XIII :) I would look at GDI+ or at the veary least Imbedding Flash into your app. But GDI+ would be my choice, less overhead and easier to get started.
-
Here is a sample class that lists SQL Servers on the Network, you should be able to moderfy it for all machines. Public Class clsNetAPI32 Private Const SV_TYPE_SQLSERVER = &H4S ' NetServerEnum Return Values Private Const ERR_SUCCESS = 0 Private Const ERROR_MORE_DATA As Int32 = 234 Private Const ERROR_NO_BROWSER_SERVERS_FOUND As Int32 = 6118I Private Structure SERVER_INFO_100 Dim sv100_platform_id As Integer Dim sv100_name As Integer End Structure ' ' level : Specifies the information level of the data ' bufptr : Pointer to the buffer that receives the data ' prefmaxlen : Specifies the preferred maximum length of returned data, in bytes ' entriesread : Pointer to a value that receives the count of elements actually enumerated ' totalentries : Pointer to a value that receives the total number of visible servers and workstations on the network ' servertype : Specifies a value that filters the server entries to return from the enumeration ' domain : Pointer to a constant string that specifies the name of the domain for which a list of servers is to be returned ' resume_handle : Reserved; must be set to zero Private Declare Unicode Function NetServerEnum Lib "netapi32" _ (ByVal servername As IntPtr _ , ByVal level As Integer _ , ByRef bufptr As IntPtr _ , ByVal prefmaxlen As Integer _ , ByRef entriesread As Integer _ , ByRef totalentries As Integer _ , ByVal servertype As Integer _ , ByVal domain As IntPtr _ , ByVal resume_handle As Integer _ ) As Integer Private Declare Function NetApiBufferFree Lib "netapi32" _ (ByVal BufPtr As IntPtr) As Integer Public Function GetListOfServers(ByRef colSQLServers As Collection) As Boolean Dim sServerName As IntPtr = IntPtr.Zero Dim iLevel As Integer = 100 Dim lBufPtr As IntPtr Dim iprefMaxLen As Integer = -1 Dim iEntriesRead As Integer Dim iTotalEntries As Integer Dim sDomain As IntPtr = IntPtr.Zero Dim iResumeHandle As Integer = 0 Dim iReturnValue As Integer Dim sctSrvList As SERVER_INFO_100 Dim nStructSize As Integer = Marshal.SizeOf(sctSrvList) Dim scSQLServers As New Specialized.StringCollection Dim iIndex As Integer colSQLServers = New Collection iReturnValue = NetServerEnum(sServerName _ , iLevel _ , lBufPtr _ , iprefMaxLen _ , iEntriesRead _ , iTotalEntries _ , SV_TYPE_SQLSERVER _ , sDomain _ , iResumeHandle _ ) If iReturnValue = ERR_SUCCESS Then ' Loop through each SQL Server returned by the NetServerEnum call For iIndex = 0 To iEntriesRead - 1 ' Convert each SQL Server entry into a SERVER_INFO_100 structure sctSrvList = DirectCast(Marshal.PtrToStructure(New IntPtr(lBufPtr.ToInt32 + (nStructSize * iIndex)) _ , GetType(SERVER_INFO_100) _ ) _ , SERVER_INFO_100 _ ) ' Add each SQL Server SERVER_INFO_100 structure entry into the StringCollection scSQLServers.Add(Marshal.PtrToStringUni(New IntPtr(sctSrvList.sv100_name))) Next End If ' Clean up regardless of iReturnValue Call NetApiBufferFree(lBufPtr) ' Move from String Collection to Array To Collection ' I only return the list as a collection because ' collections are what I am used to Dim sSQLServers(scSQLServers.Count - 1) As String scSQLServers.CopyTo(sSQLServers, 0) For iIndex = 0 To sSQLServers.GetUpperBound(0) colSQLServers.Add(sSQLServers(iIndex)) Next Return True End Function End Class
-
'Open and close a connection using the SQL Client .NET Data Provider. Dim cnOleDb As New OleDbConnection cnOleDb.ConnectionString = "Provider=SQLOLEDB; "Data Source=(local);InitialCatalog=Northwind;..." cnOleDb.Open() ... cnOleDb.Close() 'Open and close a connection using the SQL Client .NET Data Provider. Dim cnSql As New SqlConnection cnSql.ConnectionString = "Data Source=(local);" & _ "Initial Catalog=Northwind;..." cnSql.Open() ... cnSql.Close() 'Using OLEDBClient Returning and Displaying Data from a Datareader Dim strConn, strSQL As String strConn = "Provider=SQLOLEDB;Data Source=(local)\NetSDK;" & _ "Initial Catalog=Northwind;Trusted_Connection=Yes;" Dim cn As New OleDbConnection(strConn) cn.Open() strSQL = "SELECT CustomerID, CompanyName FROM Customers" Dim cmd As New OleDbCommand(strSQL, cn) Dim rdr As OleDbDataReader = cmd.ExecuteReader() While rdr.Read() Console.WriteLine(rdr("CustomerID") & " � " & rdr("CompanyName")) End While rdr.Close() 'Faster Method Dim strConn, strSQL As String strConn = "Provider=SQLOLEDB;Data Source=(local)\NetSDK;" & _ "Initial Catalog=Northwind;Trusted_Connection=Yes;" Dim cn As New OleDbConnection(strConn) cn.Open() strSQL = "SELECT CustomerID, CompanyName FROM Customers" Dim cmd As New OleDbCommand(strSQL, cn) Dim rdr As OleDbDataReader = cmd.ExecuteReader() Dim intCustomerIDOrdinal As Integer = rdr.GetOrdinal("CustomerID") Dim intCompanyNameOrdinal As Integer = rdr.GetOrdinal("CompanyName") While rdr.Read() Console.WriteLine(rdr(intCustomerIDOrdinal) & " � " & _ rdr(intCompanyNameOrdinal)) End While rdr.Close() or ... Dim rdr As OleDbDataReader = cmd.ExecuteReader() Dim intCustomerIDOrdinal As Integer = rdr.GetOrdinal("CustomerID") Dim intCompanyNameOrdinal As Integer = rdr.GetOrdinal("CompanyName") While rdr.Read() Console.WriteLine(rdr.GetString(intCustomerIDOrdinal) & " � " & _ rdr.GetString(intCompanyNameOrdinal)) End While rdr.Close() 'Connecting to a Database and filling a DataSet using a Dataadapter.fill Dim strConn, strSQL As String strConn = "Provider=SQLOLEDB;Data Source=(local)\NetSDK;" & _ "Initial Catalog=Northwind;Trusted_Connection=Yes;" strSQL = "SELECT CustomerID, CompanyName, ContactName, Phone " & _ "FROM Customers" Dim da As New OleDbDataAdapter(strSQL, strConn) Dim ds As New DataSet() da.Fill(ds)
-
Yes it can be done, but I would lead you away from it. It can make your DB go out of control. The best solution is to have a link in the db to the page stored on disk.
-
-
Try these links Reading Share information http://www.codeproject.com/csharp/networkshares.asp Creating a FileShare http://www.codeproject.com/dotnet/pinvokeaddshare.asp
-
It might have something to do with the ACL. Try forceing the permissions on the creation of the share.
-
Sybex has a book out on c# network programming, and it has a lot of good resources. Also look at codeproject.com, planet source code, and gotdotnet.com, they have heaps on the subject.
-
Thanks there are still some bugs and things I wish to work on, and will do today. Remember that the server only processes messages, To chat you will need to have 2 clients running. At the moment the network addressing in the server does not work, the system will run on the localhost and on port 9798. When the client starts enter the address of 127.0.0.1 and it will connect then type message in text box on the bottom and press send button. Messages will be displayed in the server window, and sent to the clients. I will update non working functions of the GUI today.
-
As promised here is a small example of using DP in a client server system. It is just a basic chat system. At the moment there are some small bugs in it and some unfinished sections but the base code is there and I will be updating it over the next week or so.mdxChat.zip
-
From what I understand the DirectPlay System uses both.. (IWill have to check.. Outcomes the packet Sniffer, and will get back to you), The problem I have with UDP, is that the packets are not garentied to get there and the order of arivale can be all over the place.
-
I have almost finished the example for you and documenting it, I am trying to add as many features as I can so that you can get an overview of the DPlay system. Working on a chat system. In the first version I will not have any charater conrtrol on the server, it will be so that all users can log on and use the system through the client. Next version will have log on and security systems, as well as an information store for the information that is need to run the server. Should have it completed this weekend, Been a busy time at work... :(
-
I picked up Toms book on Managed Direct X to learn the main classes, But as there is not much on Managed DX I have started to convert a lot of C++ code over to managed DirectX. The problem is that I like to do most of my stuff in C# and I have found that most examples in the community are based on VB.net. So I have learnt to code in both and then convert to C# when I have the idea grounded.
-
I have been DPlay for a good six months now, and have only had to open 1 port on the server.
-
You can set the sprite object to NULL. (C# Code above) and it works.