|
I don't want access the class, but the current instance of the application. How can I obtain the reference to the app?
|
|
|
|
|
Pass the instance of the application as an object in the constructor for your class.
|
|
|
|
|
Ok, thank you.
Is there any other/elegant aproach how can it be done in case if I have a lot of nested methods?
|
|
|
|
|
Well, frankly speaking, I do not see what is not so elegant about passing an object into the constructor. May be if you post some code, I can understand the situation well and could help you if i can.
|
|
|
|
|
E.g.:
namespace namespace1
{
class HttpAppObj : HttpApplication
{
public s_i = 5;
HttpAppObj.method1()
{
namespace2.cobj2 obj2 = new namespace2.cobj2();
obj2.method2();
}
}
}
namespace namespace2
{
class cobj2
{
cobj2.method2()
{
namespace3.cobj3 obj3 = new namespace3.cobj3();
obj3.method3();
}
}
}
...
namespace namespaceN // E.g. N = 20;
{
class cobjN
{
protected int i = 0;
cobjN.methodN()
{
namespace1.HttpAppObj appObj = ???Global app instance???; // This is my task...
i = appObj.s_i;
}
}
}
|
|
|
|
|
Hi. I want to share data (counter) among clients connected to the ASP.NET server. How could I do that? The data need not be persistent in case of server shutdown.
Thank you for your help.
talbot
|
|
|
|
|
You must post ASP.NET questions in its respective group.Anyways the answer would be to save the data in the application state. you can share an application state with all the users of your application.
|
|
|
|
|
I want to display the node text after selection in a label. However i need to restrict this display to only the 3rd-child node in the list so in other words,
CompanyName
-
DeptName
-
UserName
-
UserPC
UserPhone#
- Dept1Name
-
User1Name
-
User1PC
User1Phone#
I want to restrict the display of name to only the username, user1name, user2name, etc. nodes, and it needs to stay until the next user name is selected... Once i figure out the restriction portion i'll beable to set the label text static until the next username selection...
just would like some assitance with the setting of the node restriction.
any ideas?
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
I'm guessing that everyone was gone for the holidays, So i'm hopping that by adding to this thread will give it some more visiblity......
Help!!!!!
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Easy. Each Node has a Tag property. Just set the Tag property to some value that signifies it as a displayable node.
TreeNode newNode = new TreeNode();
newNode.Tag = 0;
newNode.Tag = 1;
When the user selects a node, check its Tag property to see if it should be displayed in your label.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hmm, good catch...
but,
can't do it
all of my nodes (save the root) are loaded by the dataReader, so i am currently loading the node text and tag from the db so i can't edit the tag value unless i create a tag_value coulumn on the db... where i could set the usernames as 1 and all others as 0
unless someone else has a better idea / plan.
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
was thinking about this some more...
since the Tag property is of type: object
i can pretty much do whatever i want with it, the question just becomes what is the best thing to do?
or is simply going with a primative(so-to-speak) 0 or 1 value the best option?
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
If you want to determine if a specific treenode level, you can use this...
int treeNodeLevel=1;
TreeNode tn = treenodeToBeTested;
while (tn.Parent != null)
{
tn = tn.Parent;
treeNodeLevel++;
}
You can then say...
if (treeNodeLevel == 3)
{
...do whatever
}
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Thanks,
I'll have to check this out...as i'm not at a point right now to test it...but i will post the results of my testing shortly
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Works like a champ!
--had to do a little bit of modification as you had the nodelevel declared as a 1 so it would then increment to 4 before ever actually reaching the desired point...so mod it to a 0 rather than 1 and its pretty...course i could have just changed the if == to value to 4, but then it would not have been the soulution i was looking
Thanks a bunch!
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Hello all,
How can i count the nuber after the decimal point.
Please Help
Thanks
Hoho
|
|
|
|
|
Can you provide more information? I did not understand what you meant by count the number!!
|
|
|
|
|
Thanks for your reply
I need to count how many numbers after the decimal point for instance if 3.44 or 3.4 i need to count how many number after the decimal point it is now two number in the frist number and one number in the frist number.
Thanks for your time
Best regards,
Hoho
|
|
|
|
|
Very tricky.
The problem is in the datatype you use to represent the number. Floating points don't accuratly represent the number they are supposed to. It could be off by a very small amount. Thus, if you have a number like 17.2, the internal representation may be 17.1999999. Your may want 1, because 17.2 is the real value, or you may want infinity, because the real value repeats for ever.
How important is it that you can do this?
Roy.
|
|
|
|
|
Hello!
One thing that comes to mind is to convert the number to a string and then search for the decimal separator:
int FractionDigits(double d)
{
string s = d.ToString();
int i = s.IndexOf(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
if (i<0)
return 0;
else
return s.Length-i-1;
} The maximum number you'll get depends on how double.ToString() formats your number. Usually you'll get up to 15 digits, but that's enough for most practical cases.
Regards,
mav
|
|
|
|
|
Hi,
Please anyone tell me, how can i include an image in my C# project and refer it.
Currently i am referring to a image in my hard drive, but i wish to include it in my project as a resource.
Any help will be appreciated..
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
You can check out the "Making it pretty" section of Building the CVS Root File Changing Utility.
In short, you add the image to your project, make it an embedded resource, and then use GetManifestResourceStream to get the image.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Gee thanks man..
That was a lot of help.
I'll try it out and tell you tomorrow.
Thanks a lot.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
OK. I have followed the simple examples found to produce a C# dll, which I can then use with RegAsm to produce a tlb file....and the end result is that I can call the original C# from within ASP/VB6. This all works fine.
However, if I amend the simple Library project to include a reference to a web service and follow the same steps (Adding a strong name file, compiling and running regasm), I end up with a strong name key error when using RegAsm. I have tried both manually compiling and also from the project.
So, I have tried separately creating a proxy class using wsdl...and then compiling this cs file into a dll, and then setting a reference to this dll in a separate servicedcomponent project. When compiling I get 'Assembly generation failed -- Referenced assembly xyz does not have a strong name'. Therefore I assume I need to apply the strong name separately to the Web Service Reference before compiling my ServicedComponent?
Fine, so I go back to the web consumer cs file, and compile it using csc /target module so that I get a netmodule, and then use Al.exe to try and link the module with the strong name. To use Al.exe I pass in the name of the dll/strong name file....and the 'Unspecified Error' that comes back complains about the original cs file which was used to create the netmodule!
Any ideas?
|
|
|
|
|
OK, I have managed to run this again and avoid the error from the the Al.exe.
|
|
|
|