|
Greetings All,
I am using a DataGrid bound to two tables with a master-detail relationship. As expected, I may click on the expander, click on the link, then view the detail for a particular master record. My problem: some master records may have detail and some may not ... for the master records without detail, I would like for the link *not* to show. The default behavior shows the link and after the click presents null detail data. Any ideas?
Thanks,
Bitwise
|
|
|
|
|
This functionality is pretty deeply encapsulated in the DataGrid control's private members, so you really can't change it.
You could, however, use two DataGrid s that use the same data source, but the second (detail) DataGrid uses the DataRelation between two DataTable s instead of the DataSet or DataTable itself. When you click on a row in the master DataGrid , the detail DataGrid shows the related records, if any.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!.
I have problems when I use two DataReader associated with a Connection.
I can't have more than one DataReader for each connection without closing one of them?.
The code throws the follow error:
<br />
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll<br />
<br />
Additional information: There is already an open DataReader associated with this Connection which must be closed first.<br />
I need the thow DataReaders open because for each read of DataReader1 I do operation with DataReader2 in another table.
I need two or more DateReader working together. How can I fix that?.
Thank you.
Demian.
|
|
|
|
|
You must use a seperate connection for each reader.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Alternately, you could forego the DataReader s entirely and use DataAdapter s to read all the data into DataTable s up-front and then you can operate on the (now disconnected) data without worrying about the database connections at all.
...just a thought...
Bill
|
|
|
|
|
In Crystal Report,How to set line's Properties such as : Width,Supress and Left ?
I had tried like this:
"ReportDoc.ReportDefinition.ReportObjects[ ObjectName ].Width
= 1100"
but i can't works while the object is a line.
thanks
Xpelive
|
|
|
|
|
I'm puzzled in the using of Request.cookies and Response.cookies. Could you help me an easy way to understand when i need use Request.cookies and when i need use Response.cookies.... thank you very much... Any answer would be appreciate...
|
|
|
|
|
Simple explanation: Request object is used to retrieve data from client, while Response object is used to send/write data to the client. In cookies example, use Request.cookies to read the cookie collection and use Response.cookies to create/add new cookie to the collection.
|
|
|
|
|
Hi. How can I freely position a StatusBarPanel in a StatusBar? As an example I'd like to draw the first StatusBarPanel in the collection directly on the left within the StatusBar and the second one 100 pixels away. Overriding the DrawItem event handler makes it possible to change colors, font etc. of a panel but not to change its location within the parent.
Thanks,
Mark.
|
|
|
|
|
Change the widths of the panel. The first panel will be on the left, the second will be placed after the first, so if you want the second panel to start 100 in, then set the width of the first to 100 pixels.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
hi , how can i rotate an image around the z-axis (i think its the z axis i want)
i have a picture of a playingcard , the backside of it.
and now i want to rotate it so the player can se the front side of it.
how can i do this?
//Homer
|
|
|
|
|
Would that be the hypothetical zee-axis?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I have an Image. I wanted a perticular part of that image of know dimensions that is the Rectangle is know.
Can some one tell me how to get this perticular part of the Image.
Cheers
|
|
|
|
|
|
You can also use Bitmap.Clone. It lay you specify a rectangle, which is the part of the image.
With Clone, the resulting image will keep the PixelFormat of the source. For instance, if your first image is 8 bits per pixel, indexed, the cloned image will be also.
If you use the other method, with DrawImage, the image must be at least 16bpp I think.
|
|
|
|
|
My project is now to parse the Select SQL String typed by the user to visualize the table, the relation ship, the type of JOIN, the Critical etc... in a form. Would you please give me some hints or some algorithms or tell me if there would an OCX solved this problem? I tried my best to solve this problem but it's too complicated. In MS SQL Server, the SQL string is parsed that is different from the SQL string parsed in MS Access. Thank you.
PS: Actually, there are too many keywords in one SQL string, especially after FROM in the SQL string. And I don't care 'bout what databse is.
|
|
|
|
|
I have a PatientInfo class with some properties (Name, Id, ...), I also have a PatientPrescriptionInfo class that is derived from PatientInfo and as an extra property (PrescriptionCount).
Now I want to cast a PatientInfo object to a PatientPrescriptionInfo object but at runtime I get an 'System.InvalidCastException' exception. How can I solve this? How can I convert a PatientInfo to PatientPrescriptionInfo?
|
|
|
|
|
Unless I am mistaken, you've got the relationship backwards: You can cast the derived class as the parent class (your PatientPrescriptionInfo can be cast as a PatientInfo) but not the other way around.
|
|
|
|
|
Hello,
I'd like to delete file from remote server on client-side. Remote objects are accesed on client using interface, but i don't know which method use to call them.
thanks in advance
|
|
|
|
|
You could do it by getting a proxy to a System.IO.FileInfo object on the client representing the file on the server, then call the Delete() method on that FileInfo object.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
I have a question about the Mem Usage column of the Processes tab of the Windows Task Manager. It seems like any application I write (c#, MFC, whatever) every control (window) event or new form will cause the Mem Usage to go up a little bit. The strange thing is that the Usage rarely releases the same amount as it incremented moments earlier. I don't get it, I create and show a User Control, and I dispose it, and the Mem Usage claims my application is eating up a higher level of resources. Should I be concerned that my application is not releasing resources? How accurate is this Mem Usage thing? A few hundred K every couple of minutes doesn't seem terrible, but if my application is open for hours (which it will be) then by the end of the day, it'll be using a lot of resources (and probably run pretty slow). Some info on this, and how I could possibly identify any problems might be helpful...thanks!
|
|
|
|
|
The TaskManager is not exactly the most accurate method of measuring how much memory your app is using. Use Performance Monitor instead. You can get more accurate metrics and monitor things such as when the Garbage Collector runs and how much memory if freed.
But, don't worry, you're not going to run out of memory. Just because you Disposed an object, doesn't mean that it's freed from memory at that instant. Dispose tells an object to clean up it's resources in preparation for being destroyed. When you call Dispose, the object closes any connections, handles, frees any memory that it allocated, or whatever. The object is then orphaned, meaning that no code can reference that object. The garbage collector, on it's own schedule, then scans the memory space of your app and destroys and frees up memory when it detects an orphaned object. This can take a while if your system has lots of memory available or more frequently as system resources and memory dwindle.
RageInTheMachine9532
|
|
|
|
|
Thank you, this is exactly what I was hoping to hear. Your post was very helpful!
|
|
|
|
|
While the task mgr isn't the greatest performance monitor, it will indicate at least when memory goes up or down. Keep in mind that an operating system's job is to dish out memory when allocation requests come in. It WILL know how much is being given to an application because the OS is what's giving the application working memory.
One thing about forms, though, you need to dispose of them if you ever display a modal dialog via ShowDialog . A simple way of doing this is like:
using (MyForm form = new MyForm())
{
myForm.ShowDialog();
} This disposes native handles (memory addresses) that the CLR does not manage, which is why you keep seeing your memory go up and up when you open new forms. You can also do this modeless forms (via Show ), but it's not necessary.
Basically, any type that implements IDisposable and uses native handles (like FileIOStream ) should be disposed when you're done using it. With System.Windows.Forms.Control you typically don't need to as it cleans up itself pretty well, but disposing it wouldn't hurt when you're done.
It all comes down the CLR and the garbage collector. The reason .NET languages are also call managed languages is because they're managed by the CLR. But native handles aren't managed by the CLR, so you need to make sure that they're "clean-up" (i.e., native resources are released).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I've found a very strange problem and I badly need a fix for it.
I have a simple interface defined in one class library, let's say WindowsLibrary1:
[code]
namespace WindowsLibrary1
{
public interface ITest
{
void Test();
}
}
[/code]
I reference this class library from another project that is a WindowsApplication, lets say: WindowsApplication1.
In the WindowsApplication1 I create a simple usercontrol: UserControl1:
[code]
public class UserControl1 : System.Windows.Forms.UserControl, WindowsLibrary1.ITest
{
....
public void Test()
{ // implementation of the WindowsLibrary1.ITest.Test()
}
}
[/code]
Ofcourse all compiles fine, but I can not use this usercontol at all.
Whenever I try to drop the control on a form I get the following error message:
---------------------------
Microsoft Development Environment
---------------------------
The user control 'WindowsApplication3.UserControl1' could not be loaded. Ensure that the library containing the control has been built and a project reference has been made to the library containing the control. If you have changed the name of the user control, close and re-open the control's designer to update the toolbox item.
---------------------------
OK
---------------------------
I badly need this to make it work, so any help is greatly appreciated.
Thanks,
Corneliu.
PS>> Environment: VS.Net 2003, WinXP.
|
|
|
|