|
Hi,
I trust Control.Dispose() disposes of its children (Control.Controls), and Form IS a Control.
BTW: That should be sufficient reason for you to call base.Dispose() inside myControl.Dispose()
when inheriting from a Control.
modified on Tuesday, July 15, 2008 3:37 PM
|
|
|
|
|
Visual Studio usually gives you a Dispose method to do that.
If you're using VS, look in the Form1.Designer.cs file (depending on version).
It should look something like this:
protected override void Dispose ( bool disposing )
{
if ( disposing && ( components != null ) )
{
components.Dispose ();
}
base.Dispose ( disposing );
}
|
|
|
|
|
Thanks for answering that we should trust on the base control.dispose to dipose all child controls but i didn't get the answer on what are the controls that we need to define the dispose explicitly. Are there any e.g for those controls.
|
|
|
|
|
Simply disposing of the form will take care of it if they are built in controls that aren't accessing unmanaged resources.
I suppose you could do
foreach (Control thisControl in Controls)
{
thisControl.Dispose();
} if you have reason to be paranoid!
Dave
|
|
|
|
|
You've already had the answer to your question but I have to ask, why do you have so many controls on 1 form? Isn't this going to be a bit much for your users to take in? Step back for a minute and think about how your users are going to use the application and then look again at the number of textboxes; then see if you can figure out a way to simplify the design for your users.
|
|
|
|
|
Pete O'Hanlon wrote: Isn't this going to be a bit much for your users to take in?
I thought that same question when reading the OP. Sounds rather intimidating and unfriendly.
Pete O'Hanlon wrote: look again at the number of textboxes; then see if you can figure out a way to simplify the design
Excellent point.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
i've got a problem regarding the System.windows.forms.webbrowser-control as it won't host certain plugins that run fine in the standard iexplorer. The problem occurs roughly on 50% of the machines, interestingly mainly those with windows vista on it. (Although there are vista-PCs where it runs just fine).
Any help would be appreciated,
Michael.
|
|
|
|
|
I have a requirement to allow an ADODB Connectionless RecordSet to be passed to a COM object from an Excel VBA application.In VB.Net, I am able to open the Connectionless RecordSet by first instantiating the object, then using the object's Open() method with no parameters. In C# however, the ADODB.Recordset's Open method requires all 5 parameters be specified (source, connection, cursor type, lock type and options). I have tried setting the source and connection parameters to an Object.Type.Missing and .Net null, played with the other parameters, essentially running the matrix of all possible combinations and I still get the error "Arguments are of the wrong type..." I am rapidly reaching the level of frustration where I believe it is in fact not possible to open an ADODB Connectionless RecordSet from C#. Any suggestions"?
|
|
|
|
|
The answer to this question is in two parts.
First, the connectionless ADODB.Recordset must be passed inside an ADODB.Stream object.
Next, to open the recordset in C#, use the stream object as the source for the recordset:
recordset.Open(ADODBStream, System.Reflection.Missing.Value, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, -1)
|
|
|
|
|
Hello, Here I'm directly passing the crystal reports parameters through the code, and generating the report but for some obvious reason, I want the records to be stored first of all into a 2-dimensional array and from there writing it back onto Crystal reports.
Note : The reason why I'm looking for 2-Dimensional array is that currently upon execution I'm getting a Crystal Report with repeated records and that too upto the no. of maximum records in table.
To be more clear, lets say, that I have an access database with 30,000 records and whn I generate the crystal report I'm expecting all 30,000 records to be displayed row-by-row. But instead of that I'm getting the first record repeated 30,000 times..........NEED HELP........!!!
The actual code before storing it in 2D-array is as given below:
private void btnReport_Click(object sender, System.EventArgs e)
{ try
{
makeReport(report_file);
for (int recordCount=0; recordCount <= myTable.Rows.Count; recordCount++)
{
SetParamValue("@parameter1", myTable.Rows[recordCount]["CLNT#"].ToString));
SetParamValue("@parameter2", myTable.Rows[recordCount]"CNAME"].ToString));
SetParamValue("@parameter3", myTable.Rows[recordCount]["CSEX"].ToString));
SetParamValue("@parameter4", myTable.Rows[recordCount]["CSS#"].ToString()); crystalReportViewer1.ReportSource = ReportDoc;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "EXCEPTION");
}
}
private void SetParamValue (string paramName, string paramValue)
{
for(int i=0; i<reportdoc.datadefinition.formulafields.count;>
if(ReportDoc.DataDefinition.FormulaFields[i].FormulaName=="{" + paramName + "}")
{
ReportDoc.DataDefinition.FormulaFields[i].Text = "\"" +paramValue +"\"";
}
crystalReportViewer1.ReportSource = ReportDoc;
}
private void makeReport(string ReportFile)
{
ReportDoc.Load(ReportFile);
}
|
|
|
|
|
Whats the point of setting the same paramvalue over and over?
|
|
|
|
|
In my opinion, they are all different parameter values (i.e @parameter1, 2 and so on) are they are the parameters which are being passed into the Crystal Report under 4 different column headings (i.e Client#, Name, Sex, SSN#)..........
to be more clear, @parameter1 wud fetch the value for Client# from the code and pass it to Crystal Report and so on.............since there are 4 fields in Crsyal Reports to be displayed, I have used 4 parameter fields...........did it make any sense............it wud be nice if u can help me with a better way to do this............
|
|
|
|
|
reality_strikes wrote: crystalReportViewer1.ReportSource = ReportDoc;
Shouldn't this line be outside your loop? At the moment, it's being called in every iteration.
|
|
|
|
|
pete, thanks for the reply..........i tried even tht b4..........whn i place that line outside the loop, it displays the first record for some milliseconds and the crystal report screen blinks and then it loads the second record and it goes on till the last record and then finally the last record is displayed on the crystal report screen........still need help.............
|
|
|
|
|
I'm trying to access image resources in my application, but I can't the resources from the application, I just end up with null. I've added the resources in the properties section in visual studio 2008, and the code I'm using is
private ResourceManager res = new ResourceManager("MyNameSpace.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
Image myImage = (Image)res.GetObject("myImage.png");
But myImage is always null. I know I could use MyNameSpace.Properties.Resources.myImage.png, but I need to get the resource from a string.
|
|
|
|
|
My guess is you have it set as an embedded resource. In that case, you need to use the manifeststream of the assembly.
|
|
|
|
|
hi,
i have a custom installer class for a setup of my project.
The library has been added with custom actions and is doing his work. so far so good.
But my library (using hasp_net_windows.dll) needs second library (msvcr71.dll not a dotnet lib) (Hasp key)
and my setup doesn't find the msvcr71.dll library (also not marked as a dependency).
So during setup the code of the second library is not executed, because he did not found the file.
Does anyone has an idea in which path or dir it searches for the msvcr71.dll ?
it surely is not the dir where the setup is and also not the installation path (c:\program files)
thx
Kurt
|
|
|
|
|
I am using adobe flash cs3 and c# in my windows application.
I am sending value from c# to cs3 application. I am able to send value to flash
application. I am using flash shockwave object .
AxShockwaveFlash asFlash = new AxShockwaveFlash();
// loading multiple swf file in Layers
asFlash.LoadMovie(0,"1.swf");
asFlash.LoadMovie(1,"1.swf");
swf in Layer0 loads dynamically taking value from xml.
now I want to Load a swf in Layer0 after periodic time. and want to keep layer0
swf as it is. but when I try to load swf in Layer0 , it dosen't load it Properly.
Is there any api to unload movie .
Is there any way to solve the problem.
|
|
|
|
|
Inspired by HA and generally always wanting to do this, I've been working on a c# roguelike in my free time. I'm kind of at an impasse with my Map structure. The way I have it organized is I have two objects:
1. A MapCell, this contains the current Cell's character as well as Color, and an enum specifying whether it's Solid, Open, Water, etc. You get the picture.
2. A Map which right now is nothing but a 2D Array of MapCells.
Works good, but I need someway of implementing a map history. That is say in item drops on a cell the normal open floor character '.' gets replaced by an item character '/'. When the item gets picked up I want it to revert back to the floor character.
It's a bit more complicated then that though. So now say the player walks over the item, now the cell has a '@' character in it. If the player leaves the Item can leaves the Cell then the item still needs to persist and if the character takes the item then the floor character needs to show.
I've currently implemented the above behavior with a stack inside of the Cell object, my concern is performance on a 512,512 map. Does anyone have any better suggestions on how to tackle this? ANy help is greatly appreciated.
|
|
|
|
|
Disconnect the map abstraction from your specific implementation of the characters being drawn.
Have a map cell class that holds an enum for the floor type. Have an item class that stores the items location (or hold it in an item property on the mapcell class). and a player class that stores the players location.
When you draw the map, decide on the character to draw at the last moment. Iterate through the grid, check if the player is on the cell, (if so draw the player), then check if there is an item there (if so, draw the item), then if neither of the first checks resulted in anything being drawn, check the cell type and draw the cell. Don't ever then rely on looking at what's been drawn to decide on the current state. Use the state of the objects to decide what to do. When something changes, change the objects and call a method to simply redraw the affected cells, this will then be easy to redraw as you just look at your object state again for each cell being drawn.
(Finally, don't worry about performance until it starts to cause problems. You're writing a ascii drawn game, you really aren't going to hit any performance problems drawing a 500x500 grid of ascii characaters on any semi modern PC.)
Simon
|
|
|
|
|
Thanks allot. I suppose I just couldn't make that last leap in the logic of it. I was already having everything keep track of it's own location as well as it's own character.
|
|
|
|
|
There are 2 list box and a horizontal Splitter. When I resize the window, both the listbox does not resize proportionally. The top listbox remains in same height, the bottom listbox gets resized.
The properties for splitter is
cursor - HSplit
Dock - Top
The properties for listbox1 is
Dock - Top
Anchor - Top,Left
The properties for listbox2 is
Dock - Fill
Anchor - Top,Left
Changing the dock or Anchor do not work out..
|
|
|
|
|
Hi,
In order to get the desired resolution try setting the Dock property of first ListBox to Fill. This will ensure that the ListBox resizes proportionally to the window. Since the Dock property is set to Top, the width will resize in proportion to the window size.
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
HI,
I tried that option too.
If both the dock properties of the listbox is set to fill,
only one listbox is visible.
|
|
|
|
|