|
Every control is already given a class name. Use Spy++ from the Platform SDK (installed with Visual Studio in default installs) to determine what that class name is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the quick reply.
I have tried Spy++, but every .NET app I have written seems to have the following class name "WindowsForms10.Window.8.app1".
Is it possible to override the automatically generated name or supply some string which will be used as part of the automatically generated name?
|
|
|
|
|
If you examine the child windows, you might notice a pattern: WindowsForms10.ClassName[.8].appN . You can change the class name for a window but you have to register it first, which means you must P/Invoke RegisterClass , which of course means you have to define the WNDCLASS struct in managed code (with proper byte alignment and marshaling). You could then use this window class in your override to CreateParams .
[DllImport("user32.dll")]
private static extern ushort RegisterClass(ref WNDCLASS lpwcx);
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
private struct WNDCLASS
{
public UIntPtr style;
public WndProc lpfnWndProc;
public IntPtr cbClsExtra;
public IntPtr cbWndExtra;
public IntPtr hInstance;
public IntPtr hIcon;
public IntPtr hCursor;
public IntPtr hbrBackground;
public string lpszMenuName;
public string lpszClassName;
}
private delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); Of course, you must provide it with all the data necessary. The WndProc delegate should point to Control.WndProc , and the other data you can marshal from various properties of the Form or any other Control derivative. Use the Marshal class for assistance if necessary.
Once you've done that, the final window class would most likely be WindowsForms10.YourClassName.appN .
Another option you could consider is using global memory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi to all,
I am trying to change a boolean field in an Access database table.
<code>
DataRow[] selectRows = dscurr1.Tables["currlist"].Select("curr='true'");
foreach (DataRow myRow in selectRows)
{
idx = Convert.ToInt32(myRow["notableID"]);
}
</code>
This locates the index to the row that has the only boolean True row in this small table, but now I need to change it to False and realize I need to use an indexer to the DataRow but am lost as to how it should be laid out syntacically.
Regards,
Bill Antonacchio
|
|
|
|
|
Just use myRow["curr"] = false . If this isn't what you're asking about, please rephrase your question.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You're right - it is simple: simply create a new OleDbCommand around an UPDATE statement, or if you just change it in the DataSet like I showed you before, pass it back to an OleDbDataAdapter using the Update method, which requires that you have the OleDbDataAdapter.UpdateCommand assigned (plus InsertCommand and/or DeleteCommand if you want to support INSERT and DELETE statements as well). The SelectCommand is required.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How about
myRow["curr"].Value = false;
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
BillAnton wrote:
Clues?
Yeah - try reading the .NET Framework SDK documentation, seriously. OleDbDataAdapter.Update takes a DataSet . As I said, you update the value in your DataSet (via the DataRow as I coded in my first reply). Then, you pass that DataSet (without calling AcceptChanges first) to OleDbDataAdapter.Update . If you have your OleDbDataAdapter.UpdateCommand set to a valid OleDbCommand with an UPDATE SQL statement, then the value in the database will be updated.
Sorry, I hate to sound rude but this is supposed to help you learn, not just take what I or anyone else said (which you didn't follow my directions anyway) and using it. Learn why I or anyone else said that and understand. That's what's important.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a showmodaldialog window where user will create one server object, can anybody let me know how do i pass the server side object back to parent window
|
|
|
|
|
In the ShowDialog window, you would make this object public and fill it with the necessary information with the normal course of your ShowDialog code. When you ShowDialog method returns to your main form code, your main form would have to set a reference to the public object, then call Dispose on the ShowDialog form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Gurus
Is there any free/community/gnu/open source/whatever C# refactoring addin for visual studio?
|
|
|
|
|
Visual Studio .NET 2005 will come with this, I just saw a demo of the Refactoring and it is sweet.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi there!
I've once seen some tools mentioned in a magazine. First had to search this, so the answer took a bit longer. Can't say if they are helpful because i never used them myself.
Search the web for "opnieuw" and "Name Manager for VS.NET". The second one is developed by the firm ScrujSoftware but should be free of cost.
Hope this helps!?
www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote:
Can't say if they are helpful because i never used them myself.
Same here, I too damn scared they break my 31337 code
top secret xacc-ide 0.0.1
|
|
|
|
|
hello,
i would like to know if there's a method in C# that can copy a hole directory with its files and subdirectories.
thanks
|
|
|
|
|
I don't believe there is; the framework is a little more modular than that: you can use File.Copy to copy a file or Directory.CreateDirectory to make a duplicate directory. From there, just call File.Copy on each file returned from Directory.GetFiles() and call Directory.CreateDirectory on each sub directory, then do this recursively for each folder.
#include "witty_sig.h"
|
|
|
|
|
|
my way to do it
private void cmdCopy_Click(object sender, System.EventArgs e)
{
if(!Directory.Exists(txtDist.Text))
{
MessageBox.Show("Please enter a valid path");
return;
}
DirectoryInfo dir=new DirectoryInfo(txtSrc.Text);
CopyDirectory(txtSrc.Text,txtDist.Text+"\\"+dir.Name);
MessageBox.Show("OK");
}
private void CopyDirectory(string src,string dist)
{
if(!Directory.Exists(dist))
Directory.CreateDirectory(dist);
FileInfo file;
DirectoryInfo dir;
string[] strFiles;
string[] strDirs;
strFiles=Directory.GetFiles(src);
foreach (string strFile in strFiles)
{
file=new FileInfo(strFile);
file.CopyTo(dist+"\\"+file.Name);
}
strDirs=Directory.GetDirectories(src);
foreach (string strDir in strDirs)
{
dir=new DirectoryInfo(strDir);
if(dir.FullName==dist)
continue;
CopyDirectory(dir.FullName,dist+"\\"+dir.Name);
}
}
|
|
|
|
|
Hello,
Why won't this work?
ds.ReadXml(filePath);
dtgAppserver.DataSource = ds;
dtgAppserver.DataMember = "appserver";
the xml-file looks like this:
<session name="dfghjgfd">
<appservers>
<appserver name="">
<appservice></appservice>
<autoconnect>false</autoconnect>
</appserver>
</appservers>
</session>
The compiler says:
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot create a child list for field appserver.
what can i do about this?
thx an advance
|
|
|
|
|
Not any XML document can be read into a DataSet . 2- and 3-tier schemas can, and attributes on the "table" tier act as fields along with any child elements. This schema will not work in a DataSet . See XML and the DataSet[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
As i have not a lot of experience with object oriented programming and design pattern, I'm here to ask for help.
This is the problem i have to resolve.
I have a database in which are stored both the structure and the content of a web application.
The structure is expressed in term of HDM methodology, i.e. a page is made up of "Entity" (data of interest to the user) or "Collection" (organised set of information object). An Entity is organised in semantic sub-units called "Components", which are pure organisational device for grouping the contents of an entity into meaningful chunks. Components can further be decomposed in sub-component, but the actual content can be associated with leaf components only. The contents of leaf components is defined in terms of "Slot" - attributes that define the primitive information elements.
A "Semantic association" connects two entities - creating an infrastructure for a possible navigation path - and has a local information object called "Association Center" which contains data that define and specify the association itself and provide additional information on how to represent both the single target elements, in a concise way, and the whole group of target elements that relate to the same source.
Collections also provides the user with a way to explore the information contents of the application- they give a preview of the target element expressed as a set of "Slot" called "Segment".
The only pattern i have identified is the Composite, but i'm sure there is more.
Moreover in the future this system have to deal with multiple user (but this is not my problem, at the moment).
Thank you, bye.
|
|
|
|
|
So what's your question?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I forgot to say that when navigate through a "Collection" o "Semantic association" the same "Entity" instance can be accessed by different way - i can find the book "It" under the "King book" collection or under the "Horror book" collection and in both case the next(previous) instance depend on the structure i navigate.
Stated that,the main question is:
1) which design pattern can i use to manage this navigational mechanism?
and also :
which class diagram better illustrate the entire problem?
thank you
|
|
|
|
|
I got a pictureBox and I put an image on it.
please show me how to print that image.
Thanks
Rock Throught The Night
|
|
|
|
|