|
It basically means that m_myObject1 is accessible, but its type, MyObject1 , is not. Something like
internal class B
{
}
public class A
{
public B b;
}
In the example above, A.b is public, but the class B is not.
|
|
|
|
|
What does "shelve" and "unshelve" mean exactly in TFS?
I am accustomed to VSS with "undo changes."
|
|
|
|
|
Hi,
Can someone help me with this scenario please.
I need to hard code the comparison of a double with the double value returned from a datatable.
The user is using a language that has the comma as a decimal separator.
double dbValue = <gets the="" value="" from="" table="" and="" returns="" it="" as="2,1">
if(dbValue < 2.1) then blah blah blah
How do I hard code the "2.1" value or is there some way to globally have .net do this.
Thanks,
|
|
|
|
|
Glen Harvy wrote: The user is using a language that has the comma as a decimal separator.
C# still uses period as decimal separator. A literal double value is always written as 2.1 in the code, regardless of any cultural settings.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks but it seems that my question may have been misleading.
If the current culture is one that uses comma's as decimal separators, why does the following throw an error..
double x = <get double="" value="" from="" dataset="">; // <-- no worries - returns 2,0
if(x > 2.1) <--- throws an error.
double y = Double.Parse("2.1", System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
if(x > y) <---- will this fix above error?????
Thanks,
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: double x = ; // <-- no worries - returns 2,0
Where do you get the value from?
Glen Harvy wrote: if(x > 2.1) <--- throws an error.
Why do you think that? There is nothing wrong with that line.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Sorry I put the source of x in brackets.
x is obtained from a datatable. The value of which is a double and as the culture is SK, I assume it's returned as 2,0 .
Glen Harvy
|
|
|
|
|
Irrespective of the culture settings, if you have a double, comparing it like if(d > 2.1) will work as expected*. Can you show some more code?
* Not exactly, but for a different reason. You should instead use if((d - 2.1) < Double.Epsilon)
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Glen Harvy wrote: x is obtained from a datatable. The value of which is a double and as the culture is SK, I assume it's returned as 2,0 .
No, as it's a double it's not formatted into something like "2,0". It's just a numierical value, and there isn't a decimal separator at all. It's first when you format a number into a string that a decimal separator character is used.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
OK...
How is the "2.1" being converted to a numeric then? In other words, the hard coded part of the equation?
I don't see how .Net can recognise it as a double because it hasn't got a "," in it.
What's good for the goose must be good for the gander
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: I don't see how .Net can recognise it as a double because it hasn't got a "," in it.
The C# language always uses period for decimal separator, regardless of any culture settings. When you write a literal value in the code, it's always written the same.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi,
i can some english. i hope you understand to my questions.
my question:
- there are a computer. this computer only allow port 21 for internet connection.
- i need connecting a webservice with this copmuter.
- i will develop a windows application for this work... possible? you are help me for this work?
Best regards from Istanbul..
|
|
|
|
|
Port 21 is generally reserved for FTP, while web services generally are exposed on port 80 (HTTP), and the issues is can you make an outgoing connection request on port 80. If not, then you cannot succeed, since you can't change the port the web service runs on (unless you are providing the web service rather than just connecting to it as a client).
|
|
|
|
|
(unless you are providing the web service rather than just connecting to it as a client).
thanks for your interest.
my web service on the a web site(www....com.tr/service/service.asmx).
please you write a short sample code with c# for this work(for windows application).
|
|
|
|
|
This normally is not done in code (and can't be done on just the client side). The owner of the web service would have to configure the web service to listen on port 21, and the client would have to query on that port. If you are implementing web service code using C# and .Net 3.0 (servicemodel namespace), the just modify the endpoint addresses in the configuration files or code for both client and server (replace :80 with :21 in the endpoint address).
|
|
|
|
|
Hi,
I need start IE in new window without addressbar, status bar but I cannot use kiosk mode (I need defined window size).
I need to know the processID of the IE process also.
Im using this code now:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE";
p.StartInfo.Arguments = "http://google.cz";
p.Start();
int pid = p.Id;
It starts the new IE window and returns its PID, but I don't know, howto hide address bar, status bar and so on..
Then I tried this approach:
System.Type oType = System.Type.GetTypeFromProgID("InternetExplorer.Application");
object o = System.Activator.CreateInstance(oType);
o.GetType().InvokeMember("menubar", System.Reflection.BindingFlags.SetProperty, null, o, new object[] { 0 });
o.GetType().InvokeMember("toolbar", System.Reflection.BindingFlags.SetProperty, null, o, new object[] { 0 });
o.GetType().InvokeMember("statusBar", System.Reflection.BindingFlags.SetProperty, null, o, new object[] { 0 });
o.GetType().InvokeMember("addressbar", System.Reflection.BindingFlags.SetProperty, null, o, new object[] { 0 });
o.GetType().InvokeMember("Visible", System.Reflection.BindingFlags.SetProperty, null, o, new object[] { true });
It starts IE window without address bar, status bar.. but I don't know, howto find processID of this instance..
Please help..
Regards,
Petr
|
|
|
|
|
I may not understand the question but can you not just embed the webbrowser object onto a new form and then display the new form?
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Thank You for this good idea, but I cannot use it.
I need start the webbrowser as a selfstanding application and not as a part of my programm..
Petr
|
|
|
|
|
Then make an app with th WebBrowser and use Process.Start
|
|
|
|
|
And howto do it please?
Thanks Petr
|
|
|
|
|
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()
{
}
|
|
|
|