|
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
|
|
|
|
|
I can give you some general directions:
Check out tutorials for ADO.NET to learn more on connecting to the access database. There are quite a few articles on the subject, so it should be pretty simple to get started.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi
If you like to use a database (for example access) to store usernames and passwords ,you can encrypt passwords so if someone has direct access to database can't use them.Then when a use wants to login get his/her password encrypt it(using the same encryption method for stored passwords) and compare it with the encrpyted password(For security reasons it's better to encrypt the provided password rather than decrypting the stored one)
If you like to prevent people accessing the database itself you should make it password protected ( an access database has two kind of authentication , you can provide a password for admin user or you can provide a password for the database itself.By defining a password for admin user you are defining a password for the access application not your database it means that if you want to open any database using your access application you should provide the admin password.
If you set a password for you database then the database is password protected and even if somebody gets a copy of it he/she can't open it unless he/she knows the password.
Regards
|
|
|
|
|
I'm using this code for printing a richtextbox content:
http://support.microsoft.com/kb/812425/ja
How can I find out the size of the printed text. Because the printed text is not the equal size of the richtextbox content, and so it can be that in the printed version one line of the richtextbox is printed in two lines...
And I need to know where the printed text ends? The Y-coordinate of the last line...
|
|
|
|
|
Hi all,
Can somebody give me some idea about how to get the current credential object in a windows application ?
Thanks and Regards,
|
|
|
|
|
Thread.CurrentPrincipal
This contains the identity of the current user and can be used to check if the user is in a specific role.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi Willem,
Thank you very much for your reply, but i need it as a Credential object!!
James
|
|
|
|