|
Don't forget to call Dispose() on the ReportDocument object too.
|
|
|
|
|
how i can make connection between windows form and sql server through code?
|
|
|
|
|
|
hi all,
i am trying to load a page in a webbrowser.
how can i be sure that the page i am trying to open is completely loaded ?
then again i want to refresh that page for couple of times. (but it must be loaded completely before each refresh)
how can i check this ?
help please.
thanks in advance,
bye.
|
|
|
|
|
Monitor the ProgressChanged event, the DocumentCompleted event isn't that reliable I've found, sometimes kicks in too early. Once you've decided the whole page has loaded then you can refresh it and start monitoring again.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Hi to all,
How/where to add libraries req. for C# project in Visual Studio 2005 framework.
Best Regards & Thanks,
Aniket Salunkhe
|
|
|
|
|
In the solution explorer you can right click on the name of the project and click "Add Reference". I believe that you can also go to the Project item in the menu and select "Add Reference"/
|
|
|
|
|
I am making a form that will will Generate a report. It will display the report from the reporting services.
From that form, I have a preview and print buttons. Preview will display the report.
and print will print the report. Printing of reports would be possible even if the report isn't displayed yet.
How will i print the report though it hasn't beens shown yet?
What could be my possible code for it?
|
|
|
|
|
Hi I've never really understood the use in this peice of code, ive been told its good practice/programming to use it and its been mentioned it had somthing to do with security but personaly i cannot see why.
<br />
private int x;<br />
public int X()<br />
{<br />
get {x}<br />
set {x = value;}<br />
}<br />
(the code might be slightly wrong doing this on the fly)
whats the use in it though surly unless your only using one of the get or the set you might as well just use a public variable that way u decrease on the code thats needed to be written, compiled and read.
any comments would be apreciated
-- modified at 6:16 Wednesday 21st June, 2006
|
|
|
|
|
Yes it is definately good practice. There is a slight mistake in it, it should be
get
{
return x;
}
And no () parentheses after X.
X is called the property of x and the reason it is good practice is because in the GET and SET section you can write code to perform any operation you want. For example, you might have a boolean variable (call it 'ready') in your class and you would only allow users to retrieve the value of x if 'ready' is true. So you could do the following:
get
{
if (ready) return x;
else return 0;
}
The same thing can be applied to the SET section, where you could for instance only allow writing of a value if 'ready' is true:
set
{
if (ready) x = value;
else x=0;
}
Now, if a variable only has a get property, it's said to be read-only. Obvsiously, since you cannot set its value to anything.
I hope this helps a bit.
Talal
"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."
--Rich Cook
|
|
|
|
|
i realised that you could enter other code into the get and set but i hadn't thought of using it in that way, which makes alot of scence.
but that was well explained thx
so as far as good practice gose its good to use it on a normal variable without any aditional code just so if somone comes along in the futre they dont have to adjust a ton of code?
|
|
|
|
|
yes, it is a good idea to always have your class variables as protected or private and expose them to the user by mean of properties.
Another common practice is to have the propery name the same as the variable name but with a capitalized first letter. i.e. roleName and RoleName.
"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."
--Rich Cook
|
|
|
|
|
It is just usefull when u want to trace a code where u can use value of 'x' and change value of 'x'. And it is more usefull for large project.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
There are already good answers to your question, but I'll give you the simple answer...
One of the corner stones of object oriented programming is encapsulation. Which means hiding implementation details from the user. When you expose a field you are allowing the user to set that field to anything they wish. When you encapsulate that field with a property, you allow the class the ability to validate data that the user tries to set to that property/field.
When designing a class, it's important to state in some fashion what the expected behaviour of the class is within a finite range of inputs. It's up to the class to determine what valid inputs are so that it can guarantee valid behaviour. Properties allow the class to take input from the user of the class and verify that it can guarantee correct behaviour with the data provided.
Granted, most people just use the most basic functionality for a property, which is to just return or set the field. But when clients of the class are using the property, you can easily change the property to do data checking later without changing how the clients use the class.
Hope that helps.
Visit BoneSoft.com
|
|
|
|
|
Hi all! I want to start programming for smart devices, I have installed smart mobile device 2003 and each time I run it, it keeps telling me that an error occured continue yes or no. I want to find out if there's any other software I need to install.
Thanks
AC
|
|
|
|
|
It might be a little more helpful to explain the error a little more. Are you getting the error when you run Visual Studio or when you are trying to run the application you have created? Are you trying to use the emulator or a device?
|
|
|
|
|
hi
I'm trying to execute an MSI installation file from inside a windows application. Here's what I'm doing:
Process p = null;
p = new Process();
p.StartInfo.WorkingDirectory = path;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.StartInfo.FileName = "Microsoft_WSE_20_SP3_Runtime.msi";
p.Start();
p.WaitForExit();
When I run it, I get a message saying the installation package could not be opened. When I run it from the command prompt, it works.
I use the same code to run osql commands and those work fine.
Any ideas what I'm doing wrong?
thanks,
Talal
"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."
--Rich Cook
|
|
|
|
|
Try setting the UseShell property of the Process.StartInfo class.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Thanks! It works. I have just tested it on the dev machine.
I couldn't help noticing your signature...I get that you were supporting Sweden yesterday?
"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."
--Rich Cook
|
|
|
|
|
Talal Sultan wrote: I couldn't help noticing your signature...I get that you were supporting Sweden yesterday?
Not really, but I couldn't have cared either way. It's just we Welsh like taking the **** out of the English but on the whole we prefer if a British team wins (we think of it as Britain rather than England playing).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I made a control library and in it derived a control from the System.Windows.Forms.Textbox control. Now some attributes that can be set for a Textbox control should not be configurable at design time by the project using the control library e.g. I don^t want the user of the control to make it accept tabs or make it multiline. Unfortunatly when I put that control on a form the designer can still see the AcceptsTab attribute in the properties-window and put it to true or false. Is there a way to make that attribute dissapear from the properties of the control?? Can I hide attributes of the base class?
Thanks for any help you might provide,
Davy
|
|
|
|
|
Have you tried overriding these properties? You could try doing that without putting any attributes on it. Maybe if you do so without specifying in the attribute where you want the property to appear, it just won't appear worth a shot...
Sorry that's all I can think of right now
Talal
"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."
--Rich Cook
|
|
|
|
|
Is it possible to configure the project in C# in such a way so that code will not compile until and unless proper xml comments are provided for all the public methods in the project classes??
Krunal C
|
|
|
|
|
If you specify the generation of the XML comments file in the project properties then you will get warnings for missing XML comments on public methods and fields. Then maybe you can enforce a policy of having no warnings - not sure whether you can force warnings for missing XML comments to be errors. No doubt in a Team Foundation Server environment you can define a check-in policy.
Kevin
|
|
|
|
|
KrunalC wrote: proper xml comments are provided
What are proper xml comments? As was stated you can get a warning but there really is no automated way that I'm aware of to enforce a rule such as this. It is more up to documented procedures and followups such as code reviews.
|
|
|
|