|
HarveySaayman wrote: is there any way around that?
Not that I know!
I think you would have to use Show() instead and handle the Closing[^] event of the frmAddUser then!
Nice WE!
All the best,
Martin
|
|
|
|
|
I'm working with C# in ASP.NET on a custom control that converts strings into images (through httphandler) - that works fine, except for 'FontSize'. First I convert FontSize to a string parameter, but after that I can't find a way to convert it into a float-value (to build a Font). In httphandler:
<br />
String sFontSize = context.Request.Params.Get("FontSize");
int iFontSize = Convert.ToInt32(sFontSize);
float iFontSize = float.Parse(sFontSize);
float iFontSize;<br />
if (float.TryParse(sFontSize, out iFontSize))
FontUnitConverter fuc = new FontUnitConverter();<br />
FontUnit fu= FontUnit.Parse(sFontSize);<br />
float flt = (float)fuc.ConvertTo(fu, typeof(float));
<br />
Font fFont = new Font(sFontName, iFontSize);<br />
Anyone any ideas?
Thanx, Brutus
|
|
|
|
|
float.TryParse ? If the string is 120pt, you need to strip the 'pt' part first, or it just won't work.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Yes, I could strip "pt" first, but the thing is that FontSize can be "Large", "Larger" etc. as well, so it's not always a "pt"-value. The size of the graphics-font I'm creating should correspond with the size of the original text-font, but the graphics-font is asking for a float value like this:
Font pFONT = new Font(sFontName, (float) iFontSize);
pGRAPH.DrawString("Text", pFONT, pBRUSH, 2, 2);
So, I'm looking for a way to somehow convert the original FontSize into a float-value.
|
|
|
|
|
In that case, you are dealing with relative values for the font size.
Therefore, you may want to have a look at this MSDN example[^].
SkyWalker
|
|
|
|
|
Thanks for pointing that out. Font.SizeInPoints is exactly what I need, but it's only for window forms, isn't it? I can't find any 'SizeInPoints'-property for fonts in ASP.NET.
|
|
|
|
|
You can use:
float emSize = Convert.ToSingle(YourWebControl.Font.Size.Unit.Value + 1);
emSize = (emSize == 0 ? 12 : emSize);
provided that you specified the Font-Size in points, e.g.: Font-Size="9pt" within your .aspx file.
SkyWalker
|
|
|
|
|
Thanks man, you're brilliant!
|
|
|
|
|
I have an application that calls win32 Dlls in c# with P/Invoke. The application works fine in the 32-bit window XP. When I migrate it to the 64-bit window XP( virtual machine ), the application fail to load win32 DLLs and with an error message of {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}. Anyone know whats the problem and how to solve this problem. Any help is appreciated. Thanks.
|
|
|
|
|
You cannot load 32-bit DLLs in a 64-bit process.
If you want to run your .NET program on a 64-bit machine but cannot provide 64-bit versions of native DLLs it uses, you should force it to run in a 32-bit process. (You will obviously lose the address-space benefits of running in a 64-bit process.) To do this, change the Platform Target property on the Build tab of Project Properties from 'Any CPU' (the default) to 'x86'.
You may want to consider generating a separate configuration for your project. Go to Build, Configuration Manager and in the Active Solution Platform drop-list, select <New...>. Then select 'x86' from the 'select new platform' drop-list and click OK.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
in vb we have keyword as call that call a method , Is there any in c# that do work like this.
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
To call a method, just specify it's name. I don't understand what you're talking about.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
let i have method test in code behind file
public void test()
{
// some code
}
i have one string varibale strMethodname ;
now i want to excute test method from this vaiable name;
i.e
public void mentodname(methodname)
{
//methodname = "test()"
strMethodname = methodname;
// i ahve to write some code so that i can execute test() function from strMethodname
// in vb we can write like this call(strMethodname)
// but waht in c#
}
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
That would be reflection.
object res = MyObj.GetType().GetMethod("MethodName").Invoke(MyObj,new object[] {arg1,arg2 etc});
|
|
|
|
|
Thanks that work fine
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
In C# no need to use that. What are you trying to do ?
|
|
|
|
|
I have a generic class "A" another generic interface "IInterface". I also have a derived class from "A". See the following code
class A<T>
{
public void Save()
{
IInterface interface = (IInterface)new InterfaceImpl();
interface.Save((T)this);
}
}
class Derived : A<Derived>
{
}
class InterfaceImpl : IInterface<Derived>
{
public void Save(Derived instance)
{
}
} As shown in the example, I need to call Save() method written inside the InterfaceImpl class. Is there any other way to do this without casting base class object to child class ? Is there any performance problem when base class object is casted into child class object ?
|
|
|
|
|
how to draw progress bar in "orbit" download in file bottom
thanks
|
|
|
|
|
Where do you want to draw it ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
can i start and stop the sql server programaticaly ?
Reason is , i have to take the backup of the database , at regular intervals. Which can't be done without stopping the service manager.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
|
My database is sql server and front end is asp.net 2.0 c#
May i use the window or web service in this case ?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
SQL server has a windows service running. You need to Stop/Start that. The Service controller class gives access to the services installed on machine. What is the problem you are facing now ?
|
|
|
|
|
I want to start/stop the Sql server service manager programatically
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Hello,
By using "System.ServiceProcess" you can start and stop a service:
Like:
public static void StopService(string servicename)
{
ServiceController actService = FindServiceByName(servicename);
if(actService!=null)
{
actService.Stop();
actService.Dispose();
}
}
All the best,
Martin
|
|
|
|