|
Try
{
Convert.ToInt32(obj);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message)
}
did u try like this...
If so what is the exception
Mail @
mail_sathish_s@yahoo.com
|
|
|
|
|
thank's for good answares but problem was on other pleace.))).
|
|
|
|
|
Here is the situation.
I have a Form, called Form1 that contains a button, this button is marked as private.
I have another Form, called Form2 the inherits from Form1.
I Want Form2 to be able to Show and hide the button in the base class, without exposing the button as protected / or public.
I Have created a public property on Form1 which has Get/Set into button.Visible property. All should work ok i can hear you shouting.
In the form2 designer, i can see the property mentioned above, and i can change its value, and the button obediantly shows and hides it self as expected. The problem is that When i set enabled to true, it adds code to the designer generated section, which speifically sets my property to true, and when i set it to false, it removes this code, but it does Not add code to set it to false. The defualt value of the property is set to true, but this has no effect.
I realise i can call this property in my form load, or in a constructor, but i would like to get the design time support. Other properties such as Enable work fine.
Any idas?
Trev
|
|
|
|
|
Try to add DesignerSerializationVisibility attribute:
<br />
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]<br />
public bool Description<br />
{<br />
get<br />
{<br />
return myButton.Visible;<br />
}<br />
set<br />
{<br />
myButton.Visible = value;<br />
}<br />
}<br />
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Unfortunately this does not have any effect. I believe that for some reason the designer believes the default value is set to false, so that when i set it to false, it does not add any code.
|
|
|
|
|
In framework 1.1 I used to do Assembly.GetTypes() and get everything, web pages, web services, classes.
In framework 2.0 it’s not the same story. There are App_code…dll, App_Global.dll, App_web…dll.
The only thing I was able to get is the App_Code by ReflectionOnlyLoadFrom() method.
Is there a way to get everything like I did before?
10x
TD
Code :
internal void Run()
{
AppDomain curDomain = AppDomain.CurrentDomain;
curDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(MyReflectionOnlyResolveEventHandler);
string assemblyPath = Path.GetFullPath(assembly.Location);
m_rootAssembly = assemblyPath;
Assembly asm = Assembly.ReflectionOnlyLoadFrom(assemblyPath);
// force loading all the dependencies
Type[] types = asm.GetTypes();
// show reflection only assemblies in current appdomain
Console.WriteLine("---- Inspection Context ----");
foreach (Assembly a in curDomain.ReflectionOnlyGetAssemblies())
{
Console.WriteLine("Assembly Location: {0}", a.Location);
Console.WriteLine("Assembly Name: {0}", a.FullName);
Console.WriteLine();
}
}
private Assembly MyReflectionOnlyResolveEventHandler(object sender, ResolveEventArgs args)
{
AssemblyName name = new AssemblyName(args.Name);
String asmToCheck = Path.GetDirectoryName(m_rootAssembly) + "\\" + name.Name + ".dll";
if (File.Exists(asmToCheck))
{
return Assembly.ReflectionOnlyLoadFrom(asmToCheck);
}
return Assembly.ReflectionOnlyLoad(args.Name);
}
|
|
|
|
|
hi there,
i have bought a notebook and now i want to the display,for example i want to turn it off when ever i want(for reducing the power consumption),how can do this on a WinXp operating system?
thanks.
|
|
|
|
|
I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something.
The parent window is in a different assembly, and the UserControl knows nothing about the parent.
How can I call the parent?
In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this?
Neil
|
|
|
|
|
i think u can use the on click event of the control
and use the SendMessage(hwnd,wparam,lparam,..) to send
a message to the parent window
Regards,
Pramod
|
|
|
|
|
The UserControl needs to raise an event. Any host (parent) can choose to respond to the event if it wants to. This is the .NET way of doing things and it's much better than the old SendMessage way.
Look up events and delegates in the documentation.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I cannot us priting the whole pages - I nedd to see the imediate reaktion of Printer
what is the simple way (some sample code - or a c# control ?)to send single commands to old line printer in C#?
Bohdan Mikolasek
softmusic@softmusic.net
|
|
|
|
|
There is no "simple" way to do this. You can find an example of RAW printing here[^] on MSDN. The code is in VB.NET, but is easily convertable to C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I dont wont to write to spooler but direct.
Is not possible in c# to write something like "Open a file called LPT1, write to is and close it."
those are the times of stupic basic LPRINT or on Atari OUT Port,char ....
BM
|
|
|
|
|
OK. You can do it the hard way then -> this[^] is how to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I used in my VB programss control MIDIPACK from Mabry(no more support). (MIDI IN; MIDI OUT, MIDI FILE,, buffers for input and output, timers
How cann I continue to use it in C#?
I need some simple control for MIDI I/O to rewrite my software for live midi aplikations in C#
Tham You for tips or help
Bohdan Mikolasek
softmusic@softmusic.net
|
|
|
|
|
Hi all, i think that im am OT but i have a questions.
Does exists a website or some other thing where i can find a customized color for the visual studio 2005 editor? i hate the classic white and its really hard to change the colors...
Regards
|
|
|
|
|
Hi all,
Here is the code:
\\----------------------------------------
public void DisplayButtons()
{
string idName = "id" + j;
string divName = "divNamee" + j;
string divId = "divIdd" + j;
string StyleStr = "visibility:visible; position:absolute; left:" + xPosCityValue + "; top:" + yPosCityValue + ";";
Response.Write("<DIV NAME = '" + divName + "' ID = '" + divId + "' runat = \"server\" STYLE = '" + StyleStr + "'>" + "<input type='image' runat='server' SRC='bulletNew.gif' ALT='" + curCityName + "' id='Image1' onserverclick='Image1_ServerClick'>" + "</DIV>");
}
protected void Image1_ServerClick(object sender, ImageClickEventArgs e)
{
Response.Write("Hello");
}
\\----------------------------------------
On clicking the imagebutton, the event doesnt trigger. I have no idea where I am going wrong. Someone Please help me. This is really urgent.
Nitya.
-- modified at 6:26 Monday 23rd January, 2006
|
|
|
|
|
That is because you are not using a server control. If you simply write out the html code for the control, the runat and onserverclick properties simply ends up in the html code, where they are totally meningless. The runat and onserverclick properies only work if you have them in code that is parsed into the page.
In this case I would simply create server objects for the elements, add the event to the OnClickproperty of the button, and add the objects into a Controls collection of an element in the page.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you for the prompt reply. I did not get you clearly. I would be very happy if you could brief little more on this with some example code. I once again thank you for the reply. (I am waiting for your reply).
Nitya.
|
|
|
|
|
What was it that you didn't understand?
---
b { font-weight: normal; }
|
|
|
|
|
Response.Write(" " + "runat='server' SRC='bulletNew.gif' ALT='" + curCityName + "' id='Image1' onserverclick='Image1_ServerClick'>" + " ");
}
You said that i need to make the "image button" as a server control, which I had already done in the above code (the attribute in the bold text).
Also, I want to ask whether it is possible to call C# method from javascript.
Thanks in advance. Please reply soon. I am eagerly awaiting.
Nitya.
|
|
|
|
|
No, it's not a server control. It's just some text in a string. Just because the string contains "runat='server'" doesn't mean that anything happens. The string could just as well contain "kill all humans", but that wouldn't happen either.
To be a server control it has to be a real object, in this case an HtmlInputImage object.
There are generally two ways of creating server controls:
1. Put the tag in the aspx page so that it is parsed into the Page object.
2. Create the object in the code behind and add it to the page structure.
nitya_arysys wrote: Also, I want to ask whether it is possible to call C# method from javascript.
Not directly. Consider these two rules:
1. The server side code and the client side code never exist in the same place.
2. The server side code and the client side code never exist at the same time.
If you want a Javascript to make anything happen on the server, you have to post the page back to the server and make the C# code detect what it is supposed to do.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa for clarifying.
|
|
|
|
|
Hello,
I try to sort my ultragrid1 in a button_click methode but I've no idea how to handle the ultrawingrid.
Something like ultragird1. sort column["column"] ???
Can anybody help me.
|
|
|
|
|
Hi Frank,
use ultraGrid1.DisplayLayout.Bands[0].SortedColumns.add(YourColumn col)
hope that helped
GanDad
|
|
|
|