|
Basically,
What I did was making a Typed DataSet called "MessageDataSet" in visual studio .NET 2003
When I want to add the dataset to my webform, I get the following error message.
"Could not add an instance of DS412.MessageDataSet to the designer.
To resolve this problem, build the project, fix any errors, and add the instance to the designer again."
Problem is when I build my project, I don't get errors. It seems to be a typical problem on my computer, coz a friend of mine ran my project on his pc and no errors were given.
Allready reinstalled visual studio, but problem persists. Allready made new project and a comparable exercise, and still the same error...
I'm really desperate...
What can be the problem ? Has it something to do with my settings of visual studio ?
Thanx in advance far any give suggestion
|
|
|
|
|
Is it possible to write the html rendered by the datagrid control to a StreamWriter? I would like to write all the html formatting and data out to a static html file.
Thanks,
Jason W.
|
|
|
|
|
The rendering methods for the DataGrid web control (as well as all other web controls) use an HtmlTextWriter . You could extend that class and provide your own that could optionally write to a file in addition to the response stream. This forces you to call the render methods in ASP.NET, however, so you'll probably want to define an IHttpHandler and associate that with a different extension Type that does what the PageHandlerFactory (for .aspx files) would normally do.
MSDN had a recent write-up on .Text (a .NET blogger) that may help. Read Serve Dynamic Content with HTTP Handlers[^] for more information.
Another option is to define a handler (like above) or an .ashx file (by default, a simple handler that must implement IHttpHandler ) that grabs the data for a DataGrid and calls RenderControl to an HtmlTextWriter created using the response stream. Then just save this file to disk. This wouldn't have any other page data - just the DataGrid output.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I need a little help here.
I am writing a winforms control in c#. This control is a non-static control that needs to have a client edge. So I started looking around for a suitable class to derrive the class from. I came up with two options...
1. System.Windows.Forms.Control
The control I'm writing is rather non-standard, and doesn't really resemble any standard controls at all. So i figured that it would be best to derrive from the Control base to make for a nice uncluttered start point. However there's a problem! I need a client edge. I could draw this with the ControlPaint.DrawBorder3D, but the client edge would remain outside this line! I have no way of knowing how much padding the DrawBorder3D adds. I could probably do it by working back into the old Win32 api, but that really defeats the whole purpose of me writing in .net!
2. System.Windows.Forms.Panel
...A second option which has served me well up till this point. Admittedly it has a lot of functionality for things like scrolling which I don't need, but overall it works well. It solves my problem of client borders - it does them automatically! It even provides a BorderStyle property which I _really_ like. It also provides setting for background colors or even background pictures! There's just one problem: System.Windows.Forms.Panel seems to eat keyboard messages before I get to look at them. I overide OnKeyDown, but I just don't recieve any messages!
Can someone tell me there's a way for Panel derrived control to recieve keyboard messages? Or failing that if there's a good way of providing a selection of client borders, and working out their padding, or alternativly if there's another base class that would be better suited to this kind of control?
Joel Holdsworth
Wanna give me a job over the summer?
View my online CV and Job Application[^]
|
|
|
|
|
How about deriving a CustomBorderedControl class from Control, and having your CustomBorderedControl draw its own border using GDI+, possibly emulating the standard Windows border styles as close as possible? Then you know exactly how big your border is because you made it yourself, and you can derive all your other controls from CustomBorderedControl. Granted, the borders would not necessarily match those of other Windows apps when the user installed a new Windows theme, but as long as you use only your own controls in your app, then at least it will have a consistent look and feel...
|
|
|
|
|
Yeah that could be one way to do it... although I'm a little tentative about manually drawing standard windows elements. I've made apps in the past which have looked perfect for win98, and then suddenly in XP they look totally yucky. This is somthing I want to avoid this time round - I just don't want my control to go obselete that way.
Joel Holdsworth
Wanna give me a job over the summer?
View my online CV and Job Application[^]
|
|
|
|
|
You could derive Control and use the ControlPaint.DrawBorder or ControlPaint.DrawBorder3D methods to draw the border you want; otherwise, you can get information about a border (like width, etc.) from the SystemInformation class and draw it yourself.
As far as a Panel goes, you really don't want to extend it. Besides including support for scrolling, it's a container control and allows other controls to be parented inside it. Keep in mind also that almost all the controls in System.Windows.Forms simply encapsulate Windows messages and classes for their respective Common Controls. How a control looks and how it behaves is defined by the common control class, which is a native (i.e., C/C++) control. The Panel class doesn't "eat" Windows messages, the underlying common control simply doesn't respond to them (well, not input messages anyway). It doesn't even have to override WndProc (nor does it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
|
Does anyone know how I would display the date that my program has been installed on a system? Also would anyone know how I would display the date(most recent) a report I have made in crystal reports has been printed?
|
|
|
|
|
An installation date is specific to the installer technology used to install the product. Windows Installer, for example, writes a registry key named InstallDate in the format YYYYMMDD. Looking at my Uninstall reg key (HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall), most of the installers besides Windows Installer don't.
If you want to have a printed date on your reports, then Crystal Reports already has support for that (just like the Office products like Word let you insert a print field). I don't remember what the field name is right off hand, but if you read the documentation for the Crystal Reports designer (or just search through the list of available fields when designing your report) it should be obvious.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi everybody! First post here, I have a question which might be simple but who knows...
You know about the SendKeys class, right? It lets you send keystrokes to another Windows application. Well, my question is, is there anything similar which will let me send mouse clicks to another application?
In case you're wondering why I want to do this, no, I am not planning on writing any trojan horse software! I'm just going to write a sort of plugin for a strategy game I have which would replace the starship design module of the game - except the game doesn't support plugins, so I'm going to do it as an external program, and I want to be able to save the user a lot of repetitive clicking - in Space Empires IV, you have to click 750 times to add 750 "plasma projection armors" to your ship (should the mod you're playing have components small enough to fit 750 of on a ship!), but in my program you would just type in 750 and it would do the clicking for you!
Thanks in advance for any help!
|
|
|
|
|
This has been asked many times in this forum. The answer is to P/Invoke SendInput . See http://pinvoke.net/default.aspx/user32.SendInput[^] for the method signature. This sends the input to the foreground window. If you have simple input you want to send (keyboard input only), you can use the SendKeys class, which also sends input to the foreground window.
This means that your application should switch the other application to the foreground before sending input. There are many ways of doing this, such as getting the processes using Process.GetProcessesByName , getting the MainWindowHandle , and pass that to a P/Invoke'd SetForegroundWindow (see http://www.pinvoke.net/default.aspx/user32.SetForegroundWindow[^]).
There are other ways but these deal with Windows messaging, something you should understand before trying to use. You can learn more about Windows messaging in the Platform SDK in the MSDN Library[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks!
Now I've heard bad things about PlatformInvoke... I know for one it's platform-specific, of course, but is there anything else I should be aware of before I go using it willy-nilly?
|
|
|
|
|
Bad things? Besides not being portable code... What bad things?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
P/Invoke is used throughout the entire .NET Framework Class Library (FCL). Almost all the Windows Forms controls, for example, "simply" encapsulate the Windows Common Controls. They P/Invoke many native methods, send and handle messages, etc. Many other classes in the FCL P/Invoke native functionality.
Sending input is platform-specific anyway.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I've developped a Windows Application that needs to know the list of all the files that are opened in all running instances of MSDev (Visual Studio 6.0).
Thanks to Mr H. Stewart I succeeded in getting the files of one instance : the first that has been registered in the ROT (running objects table)... but despite having tried many differents ways, I can't manage to get the files opened in the other instances.
Hereafter is the latest version of my code which uses iteration through UCOMIEnumMoniker and calls UCOMIRunningObjectTable.GetObject for each UCOMIMoniker. Even so, these objects are seemingly all representing the same first MSDev instance...
using Microsoft.Win32;
using DSSharedObjects;
public static string[] ImportFilesFromMSDev()
{
ArrayList AL = new ArrayList();
try
{
object[] Objects = GetActiveObjects("MSDEV.APPLICATION");
foreach( object Obj in Objects )
{
DSSharedObjects.IApplication App = Obj as DSSharedObjects.IApplication;
if ( App==null ) continue;
DSSharedObjects.IDocuments Docs = App.Documents as DSSharedObjects.IDocuments;
if ( Docs!=null && Docs.Count>0 )
foreach ( DSSharedObjects.IGenericDocument D in Docs ) AL.Add(D.FullName);
}
}
catch{}
return AL.ToArray(typeof(string)) as string[];
}
[DllImport("ole32.dll")]
private static extern int GetRunningObjectTable(int reserved, out UCOMIRunningObjectTable prot);
[DllImport("ole32.dll")]
private static extern int CreateBindCtx(int reserved, out UCOMIBindCtx ppbc);
private static object[] GetActiveObjects(string ProgId)
{
ArrayList objs = new ArrayList();
UCOMIRunningObjectTable prot;
UCOMIEnumMoniker pMonkEnum;
GetRunningObjectTable(0,out prot);
prot.EnumRunning(out pMonkEnum);
pMonkEnum.Reset();
int fetched;
UCOMIMoniker []pmon = new UCOMIMoniker[1];
while( pMonkEnum.Next(1, pmon, out fetched)==0 )
{
UCOMIBindCtx pCtx;
CreateBindCtx(0, out pCtx);
string str;
pmon[0].GetDisplayName(pCtx,null,out str);
try
{
RegistryKey Clef = Registry.ClassesRoot;
if ( Clef!=null )
{
int P1 = str.IndexOf('{');
int P2 = str.IndexOf('}');
if ( P1>0 && P2>P1 )
{
string ClassHive = @"\CLSID\"+str.Substring(P1,P2);
RegistryKey SK = Clef.OpenSubKey(ClassHive+@"\ProgID", false);
if ( SK!=null )
{
string Val = SK.GetValue("") as string;
if ( Val!=null && ProgId==Val )
{
object objReturnObject;
prot.GetObject(pmon[0],out objReturnObject);
objs.Add(objReturnObject);
}
}
}
}
}
catch {}
}
return objs.ToArray();
}
Any idea ??
Best regards,
- Éric -
|
|
|
|
|
Have you actually tried breaking into your GetActiveObjects method with the debugger and see if the while loop is entered twice? Looking at your code, there's a lot of problems , especially with the way you're using the IBindCtx s. I recommend you read over the COM documentation in the Platform SDK, especially the IBindCtx and IMoniker . Most of your code is just fine, but some of those problems could lead to what you're experiencing.
To note, you will see a CLSID (Item Monikers) for msdev.exe for each instance. You can use irotview.exe in the Common\Tools directory for Visual Studio 6.0.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes, I've worked with the debugger : the while loop is entered twice (and even one time per MSDev) but it seems that the call prot.GetObject(pmon[0],out objReturnObject) always returns the same object. Therefore I get each time the same list of files.
Well I've already tried to read carefully the COM documentation but I got lost and bogged down in too much detail (in the more so as I'm not so familiar with english).
I'm groping...
If you would mind guiding me a little bit more to get the ActiveObject for each MSDev, it would be very kind of you
What is the right way to use IBindCtx here ?
Kind regards,
- Éric -
|
|
|
|
|
Ah...details: the heart and soul - and bane - of COM programming. It is a wild beast and difficult to tame at times.
When you say you're getting the same object, what exactly do you mean? The Item Moniker will be the same because the same moniker (though referring to different instances) is registered in the ROT. Do you get a duplicate file list or something?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I mean that after calling this method :
object[] GetActiveObjects(string ProgId)
{
while ...
{
prot.GetObject(pmon[0],out objReturnObject);
objs.Add(objReturnObject);
}
}
I get an array of N objects (N=number of MSDev instances) but when casting them into DSSharedObjects.IApplication and asking for the App.Documents I get for each one the same array of files...
Ahhh... (sigh) If only I could get different DSSharedObjects.IApplication objects !
- Éric -
|
|
|
|
|
I'm sorry, but I really don't know what's wrong in that case. Out of curiosity, though, does the documents list for one application object contain a complete list of all documents open in all instances of msdev.exe?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
No, the documents list for one application object contains only the list of the documents open in the first instance of msdev.exe in the ROT. No way to reach others. So it seems that all application objects represent the same one.
So finally all I have is the number of msdev.exe and I can interoperate with only one
I'm sure it's possible... what a pity to be in a deadlock
Anyway, thank you all the same !
- Éric -
|
|
|
|
|
Hi!
I am trying to grasp the usage of SOAP extensions, and was wondering if someone can help me with this scenario:
I have a command line client which invokes a webservice. In response, the webservice is sending some XML which I would like to validate. I understand that in the case where a client _calls_ a webservice, validation can be done in a SOAP extension for the request that is coming to the webservice. The same thing can be done for a request that is outgoing from the webservice.
In my scenario, the called webservice does need to know (or does not care)about validation, it simply sends out the response. I am not sure how I can validate a response from this webservice to my client (at the client side).
Can I use a SoapExtension here? In which case, how would I configure the client so that when it receives a response, the extension is used?
Thanks in advance!
|
|
|
|
|