|
Get the Count property of the DataTable.Rows property for the DataTable in the DataSet for which you want the count, like in the following example:
int count = dataSet1.Tables["MyTable"].Rows.Count; There is a lot of functionality defined for the DataSet class and related classes, so you'd best read the documentation[^], as well as Accessing Data with ADO.NET[^] in the .NET Framework SDK, which gives a great overview of ADO.NET as well as many examples, which are also included in some of the class library documetentation.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi
Does anyone knows how to Send a Hotkey using the WinApi?
I want to send CTRL-ALT-DELETE to an Remote Client.
I should use SendInput but I don't know how.
Can anyone help me????
Best Regards
|
|
|
|
|
You can't hook the remote keyboard, this has already been answered here[^].
|
|
|
|
|
You can't use SendInput on your machine to send keystrokes to a remote machine.
You CAN use it if the remote machine is running a server application that responds to request from a client application on your machine. You can put the SendInput code in the server app and execute it on some signal that you come up with and send using the client app.
But, then, Heath already told you this... If you need to figure out SendInput and C#, then Google for it! All you need to search for is "SendInput C#". Here[^], I've done it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want get info from the Outlook Express inbox folder which is an .dbx-file. The problem is that some characters seem to be randomly converted to strange characters. Is it binary, unicode or what? How do I convert the .dbx file to plain text, like an .txt file.
/larbo204
www.nymax.nu
|
|
|
|
|
Yes it's binary. To store all that data in text would be terribly inefficient and impractical, do to look-up times and handling different text encodings.
The structure of the .dbx file is not public knowledge and can change at any time. If you want to export your mail then use the built-in export functionality from the File menu in OE, which has nothing to do with C# and is outside the scope of this forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I am trying to show, in a datagrid, a two level structure of <group> and then <company> as a child of <group>.
I can add a DataRelation between the two, but when displayed in a datagrid, when expanding the top level you are shown a link which when clicked shows a different table (the child table).
I would really like the child data to be shown in the same dataview as the parent data (indented). I have seen many controls for this in asp.net, but not for winforms. I just wondered if anyone has created, or knows how ro, create such a control.
Thanks in advance,
Richard
|
|
|
|
|
The .NET BCL (base class library) does not define such a control and to get the DataGrid to do so would be more work than it would probably be worth.
There are several third-pary libraries which offer such rich controls for an affordable price, like UltraGrid (or something like that) from Infragistics[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Infragistics is a great software , but the things is , it makes it more difficult , esp to handle the events , controls..
If you have a solution in mind , and gonna use Infra , you should consider your solutions a few more times..
Well the choice depends on you , and I saw a lot of people having the same need..
"Please more controls for Winform DataGrid"
Complex controls , or simple and efficient controls ?
Thats depend on you..
|
|
|
|
|
Bahadir Cambel wrote:
Infragistics is a great software , but the things is , it makes it more difficult , esp to handle the events , controls..
What are you talking about? They implement the event guidelines and you don't have to implement handlers to get the functionality the original poster was talking about. None of the third-party controls in this area have required complex handlers. Implementing your own control from scratch would definitely be a lot more work in terms of man hours and resources costs than a royalty-free developer license for under a few hundred dollars.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi
i have a solution with 2 project.
a webservice project ,name it A.
a client for A ,name it B.
A has some classes.
until a few days ago A's classes was validating by B.
now i have added one another class to A.
B validates previous A's classes but B doesnt know A's new class.
even i wrote new class with same content of a previous classes but
doesnt happen anything and problem exists yet.
what should i do plz?
|
|
|
|
|
|
hi
i did it already but problem exists.
|
|
|
|
|
You should both update the reference , and the client interface to the webservice.
|
|
|
|
|
Hi!!!
I have a list of all active windows in my system, I can get their handles, the tittle af the applications, etc, but I want to know the kind of application it is. I mean.. if this window is open, I'd get the tittle, that is " The code Project - Free Source Code and Tutorials - Microsoft Internet Explorer".
Do you know if I could get only the application, that is "Microsoft Internet Explorer"?
I know in this case, it seems obvious 'cos I could take it from the tittle, but with other application is much difficult.
Thanks
|
|
|
|
|
Window titles do not define a class of windows. If you want to enumerate windows for a particular window class (applications typically define their own window classes, like Word always uses the window class "OpusApp" while Internet Explorer uses "IEFrame", which you can see from using Spy++ that ships with Visual Studio and the Platform SDK tools.
With that in mind, you can P/Invoke EnumWindows and then P/Invoke GetClassName to get the Window class name. An example follows:
using System;
using System.Runtime.InteropServices;
using System.Text;
class EnumWindowExample
{
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.Error.WriteLine("Error: Please specify a window class.");
Environment.Exit(1);
}
IntPtr ptr = IntPtr.Zero;
try
{
ptr = Marshal.StringToHGlobalAuto(args[0]);
EnumWindows(new EnumWindowsProc(Callback), ptr);
}
finally
{
if (ptr != IntPtr.Zero)
Marshal.FreeHGlobal(ptr);
}
}
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, [Out] StringBuilder lpClassName,
int nMaxCount);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int GetWindowText(IntPtr hWnd, [Out] StringBuilder lpString,
int nMaxCount);
delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
const int MAX_CLASS = 256;
const int MAX_TITLE = 256;
static bool Callback(IntPtr hwnd, IntPtr lParam)
{
StringBuilder windowClass = new StringBuilder(MAX_CLASS);
StringBuilder windowTitle;
string cls = Marshal.PtrToStringAuto(lParam);
if (GetClassName(hwnd, windowClass, MAX_CLASS) != 0)
{
if (string.Compare(windowClass.ToString(), cls, true) == 0)
{
windowTitle = new StringBuilder(MAX_TITLE);
if (GetWindowText(hwnd, windowTitle, MAX_TITLE) != 0)
Console.WriteLine(windowTitle.ToString());
}
}
return true;
}
} Just compile the app and pass a class name like "IEFrame" to get all the Internet Explorer windows (those started with iexplore.exe, mind you).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
If you're trying to determine what process owns a particular window, then Heath's excellent example is the way to go. The only caveat with that approach is that you'll have to know the class name(s) that a given application uses in order to map the window class to the application.
If, on the other hand, you're just trying to identify processes that are running on the machine, you can use the System.Diagnostics.Process class. This approach would allow you to identify all processes on the machine, including those that do not have windows.
<br />
using System;<br />
using System.Diagnostics;<br />
<br />
namespace EnumProcesses<br />
{<br />
class EnumProcsExample<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
Console.WriteLine( "Enumerating processes..." );<br />
<br />
Process [] processes = Process.GetProcesses( );<br />
<br />
foreach ( Process process in processes )<br />
{<br />
Console.WriteLine( String.Format( "{0} : {1} ({2})", process.ProcessName, process.MainWindowTitle, process.MainWindowHandle ) );<br />
}<br />
<br />
Console.WriteLine( "Done." );<br />
Console.ReadLine( );<br />
<br />
<br />
}<br />
}<br />
}<br />
For the processes that do have windows, you can get the title and handle of the main window. You will not be able to get handles to all of the process's windows without some additional work, however. To do this, you could P/Invoke EnumThreadWindows to get all the non-child windows created by each thread in the process, and then you could P/Invoke EnumChildWindows for each of those windows.
If you need to be able to enumerate the windows for the process, let me know, and I'll throw together a sample for that.
Hope this helps,
PatrickShane
|
|
|
|
|
Hi all,
I need some samples for licensing the windows form application.My criteria is whenever user attempting to login the application i want to check the license key which is stored in a database table. The way to generate the license is, wherever application is installed, a KEY is generated with that computers CPU number.When user is logging in, how do we check this, (i.e.) we have application running on a server 10 users who are connecting to a server, we don't have to install the license on all the clients (PC's).
This should be checked only on the server side.
We should check the license when any one connects to a server (MSSQL) (I don't want to install license on every client, it should be only on the server, here ever the MS SQL you have installed or connecting to)
Any body have idea about this type of requirement, please send me the code samples or documentation .
thanks
sai sastry
Sai Sastry ch
|
|
|
|
|
I have this wierd problem. I have an instance of the PowerPoint class and I am calling Quit(); For whatever reason, when i do this in my console application, it works no problem. But when i do this from a Windows Service that I have made, it does not work. Is there a good reason for this?
I tried to think of some possible reasons but i can't think of any as my service and my console application are seemingly identical.
Thanks a lot!
Jim
|
|
|
|
|
I get the impression TAPI and C# has been discussed to death and I don't want to rub salt into the wounds, but how do I place a GSM call on my PocketPC (Mobile Phone Edition) using C# and .net CF.
The device (MDA II / XDA II) even offers a 'wireless modem' feature to any external device - just connect per Bluetooth/USB/serial/IrDA and issue AT commands just like any other normal modem. But I am not an external device - I am (in this context!) an application running on the MDA II / XDA II.
How do I get to place a GSM call (for V110 data) - I just want to dial my phone number and be told when I am connected, with the option to abort if this takes too long. C++ is a number too big for me and TAPI is way too complex for what I want - has somebody got a neat, lightweight C# solution... or at least a push in the right direction!
Peter Beedell
"Remember that age and treachery will always triumph over youth and ability." Quoted from the BBC Comedy 'The Office'.
|
|
|
|
|
Hi all !
I have a RichTextBox control containing red-colored text "Hello world." and
I need to get (for example but not strongly !) the following html-page:
<html><body style="color:red">
Hello world.
</body></html>
Does FCL contain any classes and methods to solve my problem ?
Many thanks !
|
|
|
|
|
Eugene Ostroukhov wrote:
Does FCL contain any classes and methods to solve my problem ?
No. You need to write your own converter. Of course, there are many, many RTF->HTML converters available on the web, some even free. Search google and sourceforge for plenty of hits.
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
Hello forum,
I want to display the input of a logfile in a textbox. The difficulty is that the logfile grows and the content of the textbox should also display the new entries in realtime. I do not want to read the whole content of the logfile and display it in the textbox. What I am looking for is to read the stream till "readline = null" and then try to read every x seconds from that position on.
Does anyone know if that is possible?
Thanks in advance,
MG
|
|
|
|
|
I would recommend the usage of the FileSystemWatcher class, so that you only re-read your log file when it has changed instead of every x seonds.
To prevent the reading of already retrieved text, store the Position property of your stream after every reading and then seek forward to this position when re-reading the log file.
www.troschuetz.de
|
|
|
|
|
|