|
The way I got it was with the Platform SDK, but there might also be another way.
|
|
|
|
|
great answer. Thanks a lot!
|
|
|
|
|
Hi there,
using a DataGrid, the usual behaviour displaying tables with relations is showing a "+" indicating the related table, right?
Now I want two Grids being synchronized, when querying one of the tables
(where one might be the parent table and the second Grid showing the related Child-Table).
So far, I tried using the DataView-Class but when using the DataView, I have to send my filter expression to both views (tables), duplicating the cpu-load...
Any Suggestions????
|
|
|
|
|
One way is to create a strongly-typed DataSet . Create two tables and have a relationship between them. Do this with the schema editor or add a new DataSet class to your project. Create an instance in the designer for your form or control of this DataSet and bind the first DataGrid to it (DataSource set to the first DataTable ). Then set the second DataGrid.DataSource property to the relationship between the two tables. This will show up in the drop-down.
You can do this through code using generic DataSet s, but you have to make sure you establish that relationship and use that in the second DataGrid 's DataSource property.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you for the answer
Just one more thing: Doing as you propose, the two tables will be in sync, so deleting one row in the parent table will change the second table, too.
Now, if don't want to change the table but only the view, let's say: only display rows with column[x] containing some value y, will this have an impact on the second table, too, or can I define some binding/relation between two DataViews?
|
|
|
|
|
mgaerber wrote:
Just one more thing: Doing as you propose, the two tables will be in sync, so deleting one row in the parent table will change the second table, too.
If you have the cascading options set accordingly in the strongly-typed DataSet , yes. It will work similar to an actual relational database (at least in that regard). The DataGrid should also update the DataView it has for the relationship.
mgaerber wrote:
Now, if don't want to change the table but only the view, let's say: only display rows with column[x] containing some value y, will this have an impact on the second table, too, or can I define some binding/relation between two DataViews?
The second view is the DataTable based on the relationship between the two. If you filter the first DataTable , the rows that would be related to rows in the second table wouldn't even exist in the view, so there's no way you can click on them to display the related records in the second table view.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks again!
Hi, I've got it all working now! You can even have Grand-Child types of relationships being synchronized by the Grid...
What I am trying next is to get multiple relations synchronized.
It is getting a little tricky here because the Grid will only accept relations as a DataMember if the Grid's DataSource is the Parent-Table.
Is there a way to let the Parent-Table(or View) change when selecting some Item in the Child-Table?
By the way, there is a great Page about Windows Forms (yes, DataGrid too!) at
www.syncfusion.com/FAQ/Winforms
|
|
|
|
|
I know that I have Data in the clipboard with the DataFormat.MetafilePict.
But I can't get it. My code is more or less the next:
/////////////////////////////////////////////////////////////
IDataObject iData = Clipboard.GetDataObject();
if ( iData.GetDataPresent( DataFormats.MetafilePict) )
{
System.Object obj;
System.Drawing.Imaging.Metafile pMetafile;
obj = Clipboard.GetDataObject()>GetData(System.Windows.Forms.DataFormats.MetafilePict );
}
/////////////////////////////////////////////////////////
Obviusly in the Debug, I enter inside the first if condition, so the code executes but the System::Object obj can't keep the data of clipboard and keeps a undefined value after the asignation.
It seems a contradiction, isn't it ?
Can anybody say me anything about get MetafilePict Data from Clipboard ?
Advanced Thanks, everybody.;)
|
|
|
|
|
<declare snippet="">
public const uint CF_METAFILEPICT = 3;
public const uint CF_ENHMETAFILE = 14;
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool OpenClipboard(IntPtr hWndNewOwner);
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool CloseClipboard();
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern IntPtr GetClipboardData(uint format);
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool IsClipboardFormatAvailable(uint format);
br mode="hold" />
<br />
if (Win32.OpenClipboard(new IntPtr(0)))<br />
{<br />
if (Win32.IsClipboardFormatAvailable(Win32.CF_ENHMETAFILE))<br />
{<br />
IntPtr ptr = Win32.GetClipboardData(Win32.CF_ENHMETAFILE);<br />
if (!ptr.Equals(new IntPtr(0)))<br />
{<br />
Metafile metafile = new Metafile(ptr,true);<br />
}<br />
}<br />
Win32.CloseClipboard();<br />
}<br /> br mode="hold" />
You can pass this.Handle instead of new IntPtr(0)
|
|
|
|
|
Does anyone know how i can create a program which can add shortcuts for windows with c#. The program run on background. So if i press a key in windows the program give me a message.
Jonathan Slenders
|
|
|
|
|
Shortcuts or hooks? If you're talking about shortcut links, this doesn't make any sense. There are articles that discuss that here on CP.
If you're talking about keyboard shortcuts, you have to install a Windows hook to handle keyboard presses if your app isn't in the foreground. While it's not a good idea to use C# to do this (too slow for handling system-level events and you have to P/Invoke functions and redefine structures), you can read the article here on CP: http://www.codeproject.com/csharp/NetWin32Hooks.asp[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
Does anyone know a book, or article, or another source about "voice communication with c#"?
thanks...
M. Ozgur Nevres
|
|
|
|
|
Checkout the Speech Application SDK at http://www.microsoft.com/speech[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi all,
i am using a check box which gets checked whn the battery is low. but instead of tht i want to place a bitmap(of say a bulb)so that i could display a red signal when the battery is low and a green signal whn the battery is high.
how do i do ths??? i dont know first how to place a bitmap picture instead of that small rectangle whic gets checked each time in a check box. Second im not sure how to change the bitmap(red to green and vice versa) during run time. orelse is there any other way to do ths???
can anyone help me plz.......thanx!!
ramya.
|
|
|
|
|
Use a PictureBox and a Label instead of the CheckBox.
The PictureBox has a property "Image" - change it, whenever you want to change the image at runtime.
|
|
|
|
|
hi i tried using picture box as u said but at run time to change i used SetBitmap to set to new bitmap image. but it didnt work. nothing got diplayed.
i cudnt find any property called "Image"....can u plz help me.
|
|
|
|
|
It's PictureBox.Image . It's there. The other thing is make sure the Bitmap is found. If you read it from a file, make sure the file actually exists and is resolved correctly. Since this file is necessary for your app, you could also embed it as an embedded resource and get a Bitmap easily by using the Bitmap(Type, string) constructor (read the docs for details). Assign that bitmap to the PixtureBox.Image property.
Using an embedded resource ensures that your image is always available and found, and that you don't have to worry about distributing it separately (either as a separate file or as a separate copy command), which could lead to file resolution (finding the file) problems.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
What C# control can i post on web that needn't install in user computer? .
This control can interact with my web service .
Thanks for your help!
|
|
|
|
|
None, at least from a client-side perspective. Just like a Java applet - if the user doesn't have a JRE installed, they aren't going to see the applet. If you use ASP.NET, though, you can use a server-side control but these actually render HTML. Not really a big deal, though. Your ASP.NET control (.ascx files or pre-compiled classes that derive from WebControl ) can talk to the Web Service. If you need a client-side control, see my article at http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388[^] - but it'll still require the .NET Framework. There's no way around it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
The DataGrid support multi-selection operations. But when I have multi-selected some rows, How can I determine which rows have been selected?
|
|
|
|
|
Create a collection of some type (like an ArrayList ), then enumerate the rows in your DataGrid . You can do this using the BindingContext of the DataGrid to get the CurrencyManager which associates rows in the DataSource to their displayed rows (since sorting or filtering may change index mapping).
For each row index, you can call DataGrid.IsSelected , passing the row index. If true , add to the collection of selected rows.
The only real question is whether or not multiple rows are truly selected (i.e., they make look it but their state is a matter of the DataGrid 's implementation).
I don't know why there isn't a much easier way (like with the ListView ). Perhaps MS thought it wouldn't be oft-used enough to warrant the resources. Of course, this could be said about a lot of things in the .NET 1.x BCL!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I've noticed that sometimes the order of my tab pages during runtime differs from the order I have at design time. Is this a bug? If not how do I stop it from happening?
|
|
|
|
|
I've consumed COM component from .NET applications using tblimp.exe to create a RCW. But sometimes, you can just "Add Reference"... When do I need "tblimp.exe" and when will I be able to just "Add Reference"?
Thanks.
|
|
|
|
|
The only difference is that using "Add Reference..." and the COM tab is that the typelib must be registered. When you add a COM reference this way, it uses either tlbimp.exe or the same code as tlbimp.exe would use. You may get a little more control using tlbimp.exe, however, but don't forget that if you want strongly-named assembly (i.e., they have to be signed) you can still do that in VS.NET. Just open the project properties of the project to which you'll add an RCW (before it's added) and specify the key file or key container at the bottom of the "General" page.
One other tip: to import ActiveX controls, you can also use aximp.exe or customize your toolbox which also creates an RCW (actually 2, one for the ActiveX control which will be derived from System.Windows.Forms.AxHost and the interop assembly for the typelib). The rules of signing still apply since the two interop assemblies are created when you add the ActiveX control to your project. One major difference about aximp.exe over VS.NET is, however, that aximp.exe can generate the source code for the AxHost derivitive class. This is sometimes handy when you want to change some things first.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi yall,
I am new to customizing controls. I have windows form with controls from edge to edge (form is filled with controls). I want to implement resizing of the controls in the following way.
- if i drag an edge of a control (#1) over the other control (#2) then the first control should be resized to the size of (#1+#2) control.
for this requirement i am not able to drag a control's edge over the other control.
all controls' sizes are multiples of a predefined height and width.
Any help would be greatly appreciated.
Thanks in advance
Udaan
|
|
|
|