|
Hi cor2879
Thank you for that!
cor2879 wrote: So just create an overloaded class, call it WidgetCollection or something like that. This class will inherit from List<widget> and also contain an instance of the StateTracker class
From this I understand that I cannot get away without creating a special class for every table in my LINQ model. Also, tell me what you think, but I think that it would work better to create a class, say, TrackedWidget which inherits from Widget, then my DataGridView's datasource is List<<TrackedWidget>>. This way I'll have object level tracking.
Another solution I've been working on, was to create a Dictionary<<int1, int2>> to record my object's state, where int1 is the value of the primary key column of that table and int2 is the state enumerator.
Thank you again for your help!
|
|
|
|
|
Hello,
I'm sure this is a simple question, but I can't find the answer.
When I call a child form within the parent form I can set the
text property of the parent form - but it is always appended with
the file name of the child form, so if I set the Text property
of the parent form to:
"Parent form heading"
what I get is
"Parent form heading" - [Childfilename]
How can I get around this ?
thanks
pcjd
|
|
|
|
|
What is your code?
I have this code and works fine for me:
private void ShowNewForm(object sender, EventArgs e)
{
Form childForm = new Form();
childForm.MdiParent = this;
this.Text = "Parent form heading";
childForm.Show();
}
Life is 5: 3 me, 1 you.
Trying to find the missing part is the meaning of Life.
And sadness is when you find that part!
|
|
|
|
|
Hello,
my code is similar to yours - but I still
get the child file name appended to the .Text string
this.Text = "Parent form heading";
ICP newMDIChild = new ICP();
newMDIChild.MdiParent = this;
newMDIChild.WindowState = FormWindowState.Maximized;
newMDIChild.Dock = DockStyle.Fill;
newMDIChild.Show();
// Result: Parent form heading = [Childfilename]
|
|
|
|
|
Hello again,
I put a typo in the last reply. The correct
test is
// Result: Parent form heading - [Childfilename]
ie without the = sign. Note the appended child file name
occurs for all of the child forms I use (about 12)
|
|
|
|
|
Sorry, I couldn't find any problem in your code. Just a question:
You wrote: child file name
What did you mean? What is a Child File Name?
Life is 5: 3 me, 1 you.
Trying to find the missing part is the meaning of Life.
And sadness is when you find that part!
|
|
|
|
|
Hello,
the child file name is just the name of the unit
eg. program.cs, so the string ' - [program]' is appended
to the parent text when this form is shown.
|
|
|
|
|
Oh, I got it. When you maximize your Child form, its Text goes in front of your Parent form, exactly what you wrote. Restore down your Child and your Parent's text will be "Parent form Header" as you expected. I don't know if there's any way to get rid of this issue, Sorry
Life is 5: 3 me, 1 you.
Trying to find the missing part is the meaning of Life.
And sadness is when you find that part!
|
|
|
|
|
Hi EveryOne,
I have a problem in enabling and Disabling the Controls in the WPF:DataGrid,
I am trying to Disable the TextBoxes in the DataGrid when the ComboBox in the same DataGrid gets the SelectedIndex as 0. The TextBoxes of the same row in which the ComboBox's SelectedIndex is 0 should be disabled.
For example, lets say there are 6 columns and 10 rows in a DataGrid,
ComboBox is in Column 3, rest are the TextBox Columns. If I set the ComboBox's SelectedIndex to 0(ZERO) of Row 3, then the TextBoxes in the Column 4 and 5 of the respective row(i.e., Row 3) has to be disabled,
Can Anybody please, help me out with this Issue????
Thank you in Advance.....
|
|
|
|
|
Hi.
I want to open a file... example... in an textbox. I just want to open the file, delete first 50 characters and then save the file and do this through the whole directory.
Any help?
PS: Files are BIG - 1MB to 250MB.
Thanks in front.
Regards,
Matjaž
|
|
|
|
|
|
I don't see why you need the text box. As previously said, you can use FileStream. I'd also suggest using System.IO.StreamReader and System.IO.StreamWriter in conjunction with the FileStream, especially if the file is not ASCII.
My LinkedIn Profile
|
|
|
|
|
Using VS2008/.Net 3.5...
I'm working on an app that has HUNDREDS of data entry forms. Here are some requirements:
0) The user must be able to open more than one form at any given time.
1) The opened forms will be constrained to a panel on a splitter container.
2) The user will be able to change the form display from free-floating windows to tabs (like the Visual Studio IDE can do).
At first blush, I think I'm going to have to make all of the forms modeless. Switching to a tabbed interface is kinda wonky though. How should I go about doing that?My first thought is to create a form that docks at the top of the panel and displays a tab for every currently opened form, and then make all of the data forms "maximized" within the panel.
Comments?
[EDIT]--------------
I created a sample app with a splitter container, and tried to add a mdi container as a child, and .Net puked on me (top-level control cannot be added to a control).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Friday, November 21, 2008 7:23 AM
|
|
|
|
|
Hi John,
AFAIK setting Form.TopLevel false demotes a Form to a simple Panel, and should allow you to
add it where ever you want it. So you can create a Form, use it modeless (TopLevel) and convert
it to a tabbed item (!TopLevel).
|
|
|
|
|
If the DE forms are created as user controls do you have more control over them. Allow them to float and when changing to tabbed control dock them to their own tab. I've not used forms a child controls, automatically think of UCs.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It really does sound like what you want is a tabbed interface (TDI) as opposed to MDI. The best third-party control I've found for this is the one from Divelements called SandDock. It has a really simple but powerful API behind and allows you a lot of flexibility. As long as you are using .NET 2.0 or later you can hook into some of the tab events to do menu merging (almost identical to MDI, except you have to do it yourself) using the ToolStripManager.Merge and ToolStripManager.RevertMerge functions. I've done this many times before and it works great.
One option would be to make your forms user controls instead of forms and then add them to the controls collection (controls[0]) of the tabbed window when it loads. The other option is to derive your forms from the tabbed window control itself, which means that they become tabbed windows in their own right. (It does get a bit more involved than that, but I've done this a lot using SandDock so I can answer questions offline as well.)
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi,
I am in little trouble to open MS office(Excel) with in My Application.
Actually I am trying to open MS Excel in
Windows Application Developed in C#.NET developed by me.
i have tried to open it through process class but it opens Excel out side my application. that i don't want i want excel in my application.
so, please so me the way to go through this trouble.
Thank you,
Chirag Shah
|
|
|
|
|
Use process class to open excel and then host it inside your application: Window Tabifier[^]
|
|
|
|
|
hi
I have a textbox in a report with text and a number format item that i got from a dataset. now i try to format the number as 12.123,12.
when i have got only a number, than i could set the property 'Format' to N so i get the number format and than set the language to French or Dutch so i got the comma on the right place.
now when i place also text in the textbox, the format setting and language settings doesn't work anymore.
so i thought i could change the format in the EXPRESSION of the textbox. i tried it like this:
=" " & Format(Fields!Bedrag.Value,"N")
for so far it works fine but i got the right format without the language. so i get 12,123.12.
does anyone have any idea how to get a string format or something that got the output 12.123,12 in stead of 12,123.12?
|
|
|
|
|
Hi,
Plz go thro the snippet below.
class C : IDisposable
{
double d;
public C()
{
d = 1.999;
}
public void UseLimitedResource()
{
Console.WriteLine("Using limited resource...");
}
void IDisposable.Dispose()
{
Console.WriteLine("Disposing limited resource.");
}
public void getvalue()
{
Console.WriteLine(d.ToString());
}
}
class DeployResource
{
static void Main(string[] args)
{
C c;
using (c = new C())
{
c.UseLimitedResource();
}
c.getvalue();
Console.WriteLine("Now Outside using statement.");
}
Output :
Using limited resource...
Disposing limited resource.
1.999
Now Outside using statement.
Now my question is does an object be called even after it is disposed ? i.e. after calling the dispose still i'm able to get the value 1.999.
Can any one explain clearly ?
Thanx
Long Live
|
|
|
|
|
yes, because the C object is defined outside the using block.
using(C c = new C())
{
// your code
}
// after this line the C object is not accesible
|
|
|
|
|
Defining the object outside of the using block has nothing to do with it. The compiler will do this anyway when it converts the using to a try/finally block. The problem is a misunderstanding between disposal and collection. Calling Dispose does not release any managed memory. The GC will do that when it runs a collection and determines that the object is no longer referenced.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
The reason is that you have declared c outside the using statement.
The Dispose method is called by the Garbage Collector when collecting objects that are not longer referenced. Because you are still holding a reference to c after leaving the using block, the GC does not collect c and consequently Dispose is called only when Main goes out of scope.
But even if you had declared c within the using statement, you are not garantueed to see the expected order of events - the GC is invoked at indeterminate points. You must use GC.Collect if you want to be sure:
using(C c = new C())
{
c.UseLimitedResource();
GC.Collect();
}
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
modified on Friday, November 21, 2008 5:26 AM
|
|
|
|
|
You are wrong: the purpose of the using keyword is exactly to call the Dispose method at the end of a scope.
The misunderstanding here is that Dispose has to be used to release unmanage resources used by an object, not to release the object itself. So, if you declare an object outside an using scope, the object and its (managed) properties are still accessible.
Try rewriting the OP example using a FileStream instead to a custom class: outside the using scope the stream object is still accessible, but you can no longer use it to read or write data.
All is explained, as usually, in MSDN[^].
|
|
|
|
|
As the other guy pointed out, the GC does not call Dispose(), because it does know about it. What it knows about, is the finalizer, which usually calls the Dispose() method.
|
|
|
|