|
That's not a bug - that's the way it's supposed to work. Reference types are not copied to different locations, they're referenced. So you're not assigning a copy of tempUnit, but your adding a new reference to it in this.Objects[openSlot] . Value types are copied (numeric primitives, enums, and structs are value types) but then UnitTypes[newUnit].name = "something else" wouldn't work as you'd expect it because the value type is copied before the name field or property is assigned. You would instead have to copy the struct back out, change it, then re-assign it.
See http://msdn.microsoft.com/msdnmag/issues/1200/dotnet/default.aspx[^] for a discussion of reference types vs. value types.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I don't know if this is the correct place to post this but I didn't see any Message Board for Crystal Reports.
I am using the Crystal reports version that comes with Visual Studio 2002. I have my reports opening in a separate form. The reports work fine but when I close the form it seems like the connection used by crystal reports is still open because I cannot do anything to my database. Sometimes it times out and sometimes I need to restart my program to release the connection. How do I close the connection between crystal reports and the database?
I've been searching online and haven't found very much on this. Thanks.
|
|
|
|
|
How are you filling your ReportDocument ? If you're using a DataSet then you're responsible for closing your connections. The DataAdater derivatives like OleDbDataAdapter and SqlDataAdapter do this manually but with connections you have to close them (or dispose them using the using block statement in C#).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm not using a dataset I made the connection using the Report Expert using the OleDb Connection. I am connecting to an access database.
|
|
|
|
|
So then the other thing I mentioned is still valid: dispose your connection. The C# using block statement is handy for that:
using (OleDbConnection conn = new OleDbConnection("..."))
{
OleDbCommand cmd = conn.CreateCommand("...");
} This will make sure the connection is closed. If you don't want to close and re-open the connection all the time, defined your OleDbConnection as a field and in your Form 's Dispose override call Dispose on your connection field inside the if block (that's where you free mananaged objects; outside the condition - so that it always runs - you free native resources like window and file handles).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm still learning the ropes in ASP.NET with C#. What is the C# code used to allow a user to log in at a website? This is done so often on ASP.Net pages, and yet I have not yet found a good reference source from which to learn how to do this.
Jeff19
|
|
|
|
|
Pickup any book on ASP.NET and you'll find what you're looking for. They all have a section on Security. There are many ways to do this, each with their own requirements, pro's and con's that it's just too much to go into in a Forum environment.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This[^] will give you a good overview.
Jon Sagara
As you may presently yourself be fully made aware of, my grammar sucks.
Sagara.org | Blog | My Articles
J.O.N.S.A.G.A.R.A.: Journeying Operational Neohuman Skilled in Assassination, Galactic Analysis and Rational Astrophysics
|
|
|
|
|
I have page 1 and page 2, page 1 has a task to do which takes about 30 seconds. And after the task is done, I need to pass the result value into page2. So when the task is processing, I would like to show a message saying "Please wait..." or a 'wait page'.
Is there any easy way to do that?
|
|
|
|
|
Yes. You said it yourself. A 3rd page needs to be used to show the "Please Wait...".
Pass the values from your data collection page to the Wait page, then have the Wait page redirect to the processing page, again, passing the same values to it.
Don't ask me for an example. I don't have one.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi, i just had the same "problem" (it isn't a prob at all).
I'm a bit confuse you just said "page" and that makes me think it could be a web page, i use this way for winforms apps but it should work anyway. You need to handle the task in a different Thread so you can do what ever you want while your system is doing the task.
To do this just add a reference to "using System.Threading" and add the following function:
public void StartMyTask()
{
Thread MyThread = new Thread(new ThreadStart(taskmethod));
MyThread.IsBackground = true;
MyThread.ApartmentState = ApartmentState.STA;
ssThread.Start();
}
Note that taskmethod must not include (). When you call StartMyTask() it will start taskmethod() in a new thread so your system do not wait until the task is performed to show the message or whatever. I assume in this example that the task is all in one method.
Hope it work.
Heinz
-- modified at 17:59 Monday 26th September, 2005
|
|
|
|
|
Sorry, there's a type error.
ssThread.Start() should be myThread.Start();
The forum does not allow me to modify the message so i posted a new reply.
|
|
|
|
|
You might want to go back and look at what the OP was asking. Your method doesn't address the problem at all and won't work in a Web Forms environment anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oh, sorry, i guess i didn't understood the problem, i thought it was a win form app and wanted to keep a window or message open while the task was being executed.
Nevermind, please don't try my code.;P
|
|
|
|
|
Hi,
I am new C#. I want to develop a C# windows app. But instead of using forms I want the output to be rendered in IE. ie when the user clicks the .exe file to execute the app, it should open in IE. The reason I want to do this is, I want to create the UI similar to a webpage(but not) to give the user a feel of ease to work with.
Thanks.
|
|
|
|
|
why not create asp.net application instead of windows forms app
MCAD
|
|
|
|
|
It is not an webapp. It is normal windows application.
The project should be executable ie .exe
|
|
|
|
|
So do you want IE to host your application or you want yor application to run IE?
I think you mean the first so suggest to use web app
can you give more details?
MCAD
|
|
|
|
|
My Project is absolutely a windows app. But instead of using dialogs or windows for UI , I want to run the app with IE and give the user a webapp feel.
|
|
|
|
|
There's no good way to do that. You can't put webcontrols directly on a winform app.
You *could* write you main form with an embedded IE controller, implement your app as a webpage, and have the installer create a local webserver that your app starts to do display the pages. In addition to being extremely nonelegant, most users don't have a licence for IIS to run an asp.net webpage. You might be able to do it by building the webpart with mono and installing apache as your local webserver, but since I've never used mono I'm not sure what if any limitations you'd be facing.
Your other option would be to write your own set of custom controls that look like web components. This would be a massive udnertaking, and as a selfdeclared newbie, you're nowhere near capable of doing so.
|
|
|
|
|
Ann66 wrote:
But instead of using forms I want the output to be rendered in IE
You really don't want to do this. This will VASTLY (can't stress this enough) complicate your interface code because .NET app's don't run natively inside a COM or OLE container.
What you're talking about doing is write your own ActiveX .EXE, which Visual Studio and the .NET Framework cannot target building. This was done pretty easily in VB6 though.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ya I guessed so...that it is not easily doable.
Anyway thanks guys for all ur help.
|
|
|
|
|
|
Running an app in the web browser could be a pain in the ass. But if you want to give a web browser looking, i have to tell you that i've seen many applications like this, for example SharpDevelop (the main window, it has links like web browser, has form controls and is a winform app).
I've seen apps that can be installed in your pc and be run from a webpage instead double clicking the exe. That's another posibility but i don't know if you have to run a web server for doing this cause there's client server interoperability.
|
|
|
|