|
Make a new .NET windows forms application and then embed a webbrowser object in the form by dragging it from the toolbox.
If you need any buttons etc it would be quite trivial to offer back, forward, stop etc.
Once this app is complete you can start it from your main app.
Hope that helps.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Hi, thank You, it's very good idea and I can use it..
Petr
|
|
|
|
|
Your Welcome
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
I am writing a simple raytracer in C# as a way of learning the language - but have run into a problem:
I have a parent class called "Primitive" which has an "Intersection" function.
I have multiple child classes, for example "Sphere" which overwrite the "Intersection" function with "new public Intersection... etc..." as their intersection methods are all quite different.
This works fine for single instances - but when I create an arraylist of primitives, such as Spheres and Planes, and the iterate through them with a foreach like this:
ArrayList PrimList = new ArrayList();
Sphere sphere = new Sphere ();
PrimList.Add (sphere);
Plane plane = new Plane();
PrimList.Add (plane);
foreach (Primitive p in PrimList)
{
i =p.Intersect (x);
}
This will always use the parent intersect function and not the appropriate child function. :/
I think it's because the Spheres are being recasted to Primitives by the foreach function....
Is there a way around this such that the correct intersection method is used?
|
|
|
|
|
bobmitch wrote: This will always use the parent intersect function and not the appropriate child function
That is because in the derived classes you have used the "new" qualifier on the method declaration which tells the compiler to hide the implementation. The reference to the base does not know about your "new" implementation.
You need to declare the method as virtual on the base, and override on the derived classes.
public virtual Intersection()
{
}
...
public override Intersection()
{
}
|
|
|
|
|
Class A{...}
void main()
{
Object o;
o=new int();
o=new String();
o=new A();
}
What will o eventually point to?
if eventually o point to A, then what happen to int and String object?
Thanks in advance
|
|
|
|
|
loke6258038 wrote: What will o eventually point to?
An instance of class A
loke6258038 wrote: if eventually o point to A, then what happen to int and String object?
The garbage collector will eventually get them.
|
|
|
|
|
Hi everybody,
I work with big XML files and i want to free up the memory after a have finished working with one file.
If i set the reference of the XmlDocument to null the memory will be free from the GC. But how can i free the memory immediately when i don't need any more the reference?
Thanks.
|
|
|
|
|
Noemi Katinka,
Call "thing.Dispose()"
Regards,
Gareth.
|
|
|
|
|
how big are these files ? You'd have to force GC, which is usually a bad idea, and can mess up memory management in general in your app. XML files are just text, there's nothing to Dispose.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Don't mess with it. Let the garbage collector do its job when the memory is needed. You can cause more problems running a garbage collection manually by ending up promoting other objects to higher generations.
|
|
|
|
|
You could use an XmlReader to parse through the document without having to load the entire document in memory. I've found this useful when loading records from very large XML files (i.e. 100Mb and above).
|
|
|
|
|
I have a DataReader that was working until I changed some code around, now it just skips over the While(reader.Read()) loop for some reason.
OleDbConnection oleDbConnection = new OleDbConnection(str2);
string strCom = String.Concat("select Unit from Units where Unit=\'", strUnits, "\'");
OleDbCommand oleDbCommand = new OleDbCommand(strCom, oleDbConnection);
OleDbDataReader HpReader= null;
oleDbConnection.Open();
HpReader = oleDbCommand.ExecuteReader();
while (HpReader.Read())
{
if (strUnits == "Length")
{
comboHD.Items.Add(HpReader.GetString(0));
}
else if (strUnits == "Velocity")
comboFV.Items.Add(HpReader.GetString(0));
else if (strUnits == "Kinematic viscosity")
comboKV.Items.Add(HpReader.GetString(0));
}
HpReader.Close();
oleDbConnection.Close();
|
|
|
|
|
The Read method returns false if there are no records. Check the results of your command externally. And because I am a pedantic A&* you should really be consistent in your variable naming casing.
(I would focus on the value of strUnits as it seems to be a good candidate for the empty results.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
string strCom = String.Concat("select Unit from Units where Unit=\'", strUnits, "\'");
changed query:string strCom = String.Concat("select Unit from Units where Unit="\", strUnits, "\"");
use changed query it will work.
|
|
|
|
|
I have contacts A, B, C
A is related to B
A is related to C
B is related to C
Data Base table are
Contact(IDContact)
ContactRelation(IDContactRelation, IDContact(FK), IDRelcontact(FK))
then I wanted to show this relationship diagramatically
please somebody provide me solution for it
rasana
|
|
|
|
|
Sure, I accept credit card payments from my website.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
|
Be careful, your teacher is probably reading those forums also.
|
|
|
|
|
If i could get some sample on how to draw the elipses and connector to those ellipses that is also fine to start
rasana
|
|
|
|
|
I'm using an invoke on a form to update the UI from a backgroundworker thread.
The problem is that the application slows down enourmously - in fact it is around >50 times faster when the UI is not being updated!
Using a delegate has the same effect.
Can anyone give me some pointers to an alternative to updating a UI from a backgroundworker that is fast.
Thanks in advance.
Guy
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
Updating UI is an extremely slow process compared to computation. The most effective way to update a UI is to do so no more than a human would reasonable expect. For example, there is no reason to update a text box more than 2 times per second, and even then that is overkill. Put in a throttle that will ignore your UI update invoke if it has already happened within a given unit of time and you will see a dramatic increase.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Thanks - that helps.
I was assuming that updating a UI was fast and I was just missing something.
Once every two seconds should be fine for my application.
I suppose C++ would be the direction to go for this sort of speed?
(A direction I have no intention of heading in just yet...)
Regards
Guy
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
GuyThiebaut wrote: I suppose C++ would be the direction to go for this sort of speed?
No, not really. You're still using slow controls that draw themselves to the screen. The language you use isn't going to make that much of an impact on the speed of the update.
|
|
|
|
|
Thanks for the information - coming from a database background this is all new stuff for me.
I'm guessing the Windows API is having to do a lot of work to update a form.
I popped a timer into the application and set the Tick event to update the UI - works like a treat now.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|