|
What is the book ? Can you do NONE of this ? If so, I suggest either the book is useless, or programming is just not for you.
Christian Graus - C++ MVP
|
|
|
|
|
Is there a method in the .NET framework that I can call to get the window with the current focus. All I've been able to find on the net is this:
// Return the handle of the window that has the focus.
[DllImport("user32.dll")]
public static extern IntPtr GetFocus();
This isn't built into System.Window.Forms?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
No, it is, by definition a PInvoke call to load a function out of user32.dll and call it.
Christian Graus - C++ MVP
|
|
|
|
|
Yeah, I just think it's strange that it's not built into the framework. Wonder what their reasoning was...
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi,
Being relatively new to C#/.Net I am having problems finding a simple solution to the following scenario:
I have a table with many fields including FirstName, LastName, MemberID and EmailAddress. I need to display a checkedlistbox with all the FirstName + LastName's BUT I need to only pass the relative selected EmailAddress to another table. I don't want to show the EmailAddress in the checkedlistbox.
I can populate the listbox as well as retrieve the selections without problem but is there a way to "hide" the EmailAddress in the checkedlistbox but retrieve it when selected?
Thanks,
Glen Harvy
|
|
|
|
|
A listbox item has .Tag right? If so, store the e-mail address in the tag, item.Tag = "mmmm@bacon.com";
You can store pretty much anything in the tag, so when your populating the list, just put it in the tag for that item.
|
|
|
|
|
Thanks for that - I've used the tag for this purpose before but forgot it.
It doesn't seem possible however to ".Add.Tag" so I will need to bind the listbox to a dataset which is what I didn't want to do <sigh>.
Glen Harvy
|
|
|
|
|
Try this when your adding an item:
ListViewItem item = new ListViewItem(stuff);
item.Tag = whatever
|
|
|
|
|
Hi
i want to generate a word document by taking data from database (sql server). i don't know how can i do that. can someone suggest me the way to do that?
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Hi,
I made a calculator which calculates measurements. The application asks you for example "how much is 200 centimeters in meters".
Because these calculations could have broken numbers i am forced to use doubles.
But when i type the answer, it keeps saying its wrong.
Suppose an answer is 0,0009. But when i look in the array which holds all the answers i see 0,0009000000000000012.
How can i solve this?
Thanks in advance!
|
|
|
|
|
"Double" stores values in base-2 representation. Like you cannot exactly represented 1/3 in decimal notation, you cannot represent 1/10 in base-2 representation. That means you always have rounding errors when using double.
Never compare two floating point numbers for equality, but instead consider two numbers to be equal if Math.Abs(value1 - value2) < 0.00000000001.
Alternatively, you might use the type "decimal" which stores numbers in base-10 representation.
|
|
|
|
|
See
modified 12-Sep-18 21:01pm.
|
|
|
|
|
See this answer for more information, it a common beginner question.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
See this answer for more information, it a common beginner question.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Thank you very much guys!
Didn't know there was an alternative type for double except for float.
But decimal did the trick!
|
|
|
|
|
I like to create (or download) a program that can let the user open several PDFs and print those on an installed printer. I don’t have to preview the PDFs.
If I have 5 documents and like to print 10 copies of those, the program should send 50 printing jobs to the printer.
_____________________________
...and justice for all
APe
|
|
|
|
|
How can we convert a byte array to stream or stream to array of byte? So How can we change the size of stream? Can we change the stream lenght(or size) bigger?
I thank you very much for your answers.
|
|
|
|
|
Stream is an abstract class, you have to use one of it's implementations.
You can create a MemoryStream from a byte array, and you can get the data from a MemoryStream as a byte array.
The size of a stream is determined from the data that it contains. You change the size of a stream by writing to it.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I got a problem of creating a global variable. Example: I want to create this variable in a diffferent .cs file named globalize.cs apart from the main file named main.cs.
I previously used in VB.NET is able to work but now I am learning C# and it seems not working in C#.
Need Your Help, Reader
Thanks
|
|
|
|
|
class SomeClass {
public static int globalVariable;
}
Just make sure to make it public and static , there you have your "global variable".
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks. But should i renamed my variable in my main.cs to SomeClass.globalVariable instead of just globalVariable?
Is there any so called short cut like having using System; we need not to retype the whole command for print a console statement. Example
Having the using System;, this is the flow of the program:
using System;
class someclass{
public static void Main()
{
Console.WriteLine("Some txt");
}
}
whereas without having using System;
class someclass{
public static void Main()
{
System.Console.WriteLine("Some txt");
}
}
|
|
|
|
|
No, because System is a namespace and Console is a class. The using command allows you to specify which namespaces to "short circuit", but it does not do it with classes.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think you get me wrong. I want to declare a global variable that can use anywhere in the program named main.cs but I don't want to type a long command.
For example, I have this file named variable.cs
using System;
public class someclass
{
public static int a = 0;
}
And I want to use it in this file named main.cs
using System;
public class somemainclass
{
Console.WriteLine("a = {0}", someclass.a);
}
I don't want to use this someclass.a. So is there anywhere i can short cut it the someclass.a to a variable named a to use as normal?
|
|
|
|
|
I didn't "get you wrong". I understood perfectly what you were trying to do, but I was trying to point out to you that the .NET framework is OO based. You cannot declare your variables outside classes and you cannot shortcut someclass.a to a.
Hint - if you could do this, it would create some awful problems with namespace resolution and method name collisions, so .NET tries to protect you from yourself.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hello again
now i have an application to ( login ) using a username and a password ....
all usernames and passwords are stored in a database ( microsoft access )
can someone help me with the source code to verify the username and its password or give me a webpage explain it
thank you
-- modified at 10:14 Saturday 18th November, 2006
|
|
|
|