|
Hello. I want to do something like this:
float number = 3 / 2;
The problem is that the decimals don't show up, all that is displayed is "1" instead of 1.5. I have tried using float/double/decimal but still the decimals disappear.
What's wrong? Am I missing something here?
|
|
|
|
|
I think you are.
In this expression, the numbers 3 and 2 are integers. If you integer divide 3 by 2 you get 1. This 1 is converted to a float implicitly because no data is lost, but it's not the value you are looking for.
Try:
float number = 3.0 / 2.0;
Regards,
Rob Philpott.
|
|
|
|
|
I have a custom title bar that I simply made from a label. My form is fixeddialog so I can get that raised effect. Everything looks great until I minimize my form to the taskbar. When I do this, I only see the corresponding icon and not the text. This is because my borderstyle isn't "none." And to have a fixeddialog form without a titlebar, you must make the text "". Therefore, I came up with this: When I minimize my form, I change the borderstyle and text so that it appears in the taskbar. The trick now is to get it to restore without the Titlebar. Essentially, I just need to do the opposite of what I did when I minimized the form.
So, my question, do I have access to the "restore" event handler that is called when you either click or right-click on the item in the taskbar? If not, does anyone have another solution to this problem? Thanks in advance.
|
|
|
|
|
Look at the Resize and SizeChanged events of the form, at least one of them's fired by a resize, although I'm not sure which.
|
|
|
|
|
Thanks Dan,
I tried that and it works. However, it flickers quite a bit. Too much to be acceptable. Any ideas? Thanks again.
|
|
|
|
|
Not really. there're properties to enable double buffering, but apparently they only work on custom controls and not an entire form. Doing manual resizing for a complex form I was able to largely reduce the flicker by massaging my code to use anchoring and nesting groups of controls in groupboxes as much as possible, and trying different ways to resize/position an object, there didn't appear to be any logic behind why X worked better than Y on control type A, while for B's you wanted to use Y instead.
|
|
|
|
|
Thanks for looking out. I just assumed that there would possibly be some win32 API that I could override to manually put the text in the taskbar.
|
|
|
|
|
Simply import the user32 dll and call the SetWindowText() method.
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public static extern int SetWindowText(IntPtr hwnd , string str);
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
SetWindowText(this.Handle , "Title");
}
Thanks again for your help.
|
|
|
|
|
Hi guys,
I've posted about this in a slightly different way in the SQL Server forum, but have had a bit of progress since then.
I have created an asymm key on the SQL server and can extract the public keys from the server using the following sql statement
select public_key from sys.asymmetric_keys
public key seems to be a 148 bit hex value.
How do i create an RSAParameters from this value?
TIA
Russell
|
|
|
|
|
Can this be done without attempting to open a file first? I can to the try catch route if not, but would prefer something more graceful.
|
|
|
|
|
There's no other way to do it. You have to try to open the file inside a Try/Catch block and see what happens.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
i have a richtext editor where the user is allowed to enter text
Now i want to trap the Vscroll event of the Rictext and here
i want to execute the sendmessage and pass the backspace key in the parameter
i want to delete the last "\n" character in the Richtext editor
any help or pointer in this case
will be appreciated
Thanks and Regards
Pramod
|
|
|
|
|
You can trap in the wndproc of the control. But you need to get the wndproc of the control, not the parent form. Try the following code to grab the event:
class RichTextBoxEx : System.Windows.Forms.RichTextBox
{
private const int WM_VSCROLL = 0x0115;
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_VSCROLL)
System.Diagnostics.Debug.WriteLine("vertical scroll");
base.WndProc(ref m);
}
}
|
|
|
|
|
I want to connect to foxpro 2.6, read data from filename.dbf files, then to write to sql server or oracle database, but i can't connect to foxpro 2.6
you can help me, can give for me code to connect to foxpro 2.6 and read .dbf files
Thank you very much
|
|
|
|
|
dbf file act as databases.
In order to connect to a dBase database you could use OleDb or ODBC just as you use Sql. (ie - SqlConnection has it's corespondent OleDbConnection, or OdbcConnection)
To get the connection string go to www.connectionstrings.com
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Thank Vlad Stanciu very much, I read data from foxpro and binding in datagrid, successed and very good, i hope you can help more than when i failed with next programs. We can make friend, my add mail: ltxuanit@yahoo.com
Bye
Thank you!
|
|
|
|
|
You are welcome.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
hi all,
what i actually want is
how to send images with in the body of mail with out as attach ment..
i,e after i sending that mail with image,
the reciepent will be shown the image in the body of mail..
any one knows..
top urgent
thanks in advance..
byeeeeeeee
sree
|
|
|
|
|
Try reading the RFC on "embedding" images into email. Then, use Google to search for tools that do that.
Always read the RFC for matters such as these.
In short, you create an email with a multipart/related MIME type, put your base-64 encoded images into the email according to the spec, and then use the cid: protocol in your IMG tags' SRCs.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
can u plz tell in details .
or else the code...
plzzzzzzzzz
bye
thanks
|
|
|
|
|
Since the only installer packagers cant do create the kind of setup im after Im going to create my own in C#.The only new thing i need to learn is how to go to the next "Page" of the setup.
Do i need to somehow "link" to a .dll file with the next page or something Also how do i close the app ? at the moment im using the "kill process" approach
oh and its just going to look like an installer it wont use the windows installer service
|
|
|
|
|
Hi there
I hope someone in here can help me with this issue.
I am trying to write a little application that recurses through a folder and sets the appropiate security on the folder, but I can't seem to get the inharitance settings to be correct.
The below code should add a user account to the ACL-list of a specified folder and set the folder security for the added account to "Modify" - applying the settings to "This folder, subfolders and files".
I've tried various combanations of Propagation- and InharitanceFlags but it still wount work like I wan't it to ;o)
I hope anyone in here can help me
// Adds an ACL entry on the specified directory for the specified account.
public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, InheritanceFlags Inheritance, PropagationFlags Propagation, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);
// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
dSecurity.AddAccessRule(new FileSystemAccessRule(Account, Rights,
Inheritance, Propagation, ControlType));
// Set the new access settings.
dInfo.SetAccessControl(dSecurity);
}
Thanks in advance
Niels
|
|
|
|
|
Hi every body i look some example for using dirextX but the compilatro sad that i have not Microsoft.DirectX names space how to get it????
best regards
|
|
|
|
|
papa1980 wrote: have not Microsoft.DirectX names space how
You need to have Managed DirectX installed on your machine
'A programmer is just a tool which converts caffeine into code'
|
|
|
|
|
from where to download it???
|
|
|
|