|
Thanks for your replay. When I run
string.Format("{0:0.0E+00}", 0.000597); its return 6E-04 but I need 5.97E-4. I do not want to round the number.
Pankaj
|
|
|
|
|
I have done some small changed in the expression and got the near of correct result
string.Format("{0:0.0E2}", 0.000597); then its returns 5.97E-004. Can we remove 00 after the E ?
Pankaj
|
|
|
|
|
Got one solution
string.Format("{0:#.0#E-00}", 1000000);
Pankaj
|
|
|
|
|
I have two table Employee and EmployeeAddress and Both Cotain ID filed with integer, I want to Join both in DataSet How can i do it ???
select * from Employee, EmployeeAddress where Employee.ID= EmployeeAddress.ID
I want to do the the above sql operation in my Dataset & need to display in girdview
My Dataset Contain two Table one is for Results of Employee another table contains details of EmployeeAddress. How can Provide First Table as Primary and Second Table as Forign Key
I tried that
Dataset objds=new Dataset();
......
......
//Analyse that Dataset contain two tables of data now then How can I provide relation and need to give to Gridview
objds.Relations.Add("Relation",objds.Tables[0].Column["ID"],objds.Tables[1].Column["ID"]);
Gridview1.Datasource = objds;
Gridview1.DataBind();
But it showing only First Table Data only I want to Join both tables as one and need to show in Gridview How can do It ?
Regars,
Shaik Haneef
sk.haneef@gmail.com
|
|
|
|
|
I don't think the GridView supports this, but you can try adding databound columns at design-time, this might permit you to bind some columns to the first table and some to the second. I doubt it tho.
|
|
|
|
|
Make sure that ID refers to the correct ID in both tables, on if then will be the ID for address and the other will be the ID for the customer. There should be a CustomerID on the address table!
You need to have done some study during your course, surely!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use LINQ to DataSet to query and join the 2 tables. The query result can be bound to the Grid or used to create a new DataTable for binding to.
|
|
|
|
|
Hi All,
I have an appliation that communicates with a hardware device attahced with the system. So far, the device had been attached using USB so the application was determining the PORT using Port Name.
Now, the newer device have 9-pin serial port. How can I now determine the Port number? I don't want to iterate through all the ports and send any command and analyse the response to determine the required Port.
Any suggestion or hint would be greatly helpful...
Regards,
-SIFAR.
|
|
|
|
|
use class "serialport".
SerialPort serialport1 = new SerialPort();
use this class and using this obj u can read port no....
ok.
TANIM
TAFIN
|
|
|
|
|
Thanks TAFIN.
I am aware about that class. My problem is how to determine the exact Port Number to which the device is attached without iterating through all the ports.
Regards,
-SIFAR.
|
|
|
|
|
There really is no way to determine that without iterating. Unless you make the user pick the port manually.
|
|
|
|
|
hey!!
im in a prob.i am trying to add some column and items in a list view.
but cant add a column even.Here is a code snippet. i am novice in C#. plz help.
Thanks in advance.
TANIM
Bangladesh
private void Form1_Load(object sender, EventArgs e)
{
ColumnHeader columnHeader1 = new ColumnHeader();
listView1.Columns.Add(columnHeader1);
}
|
|
|
|
|
Try This
listView1.View = View.Details;
listView1.Columns.Add("Column Name", 50, HorizontalAlignment.Left);
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Along with Abhijits answer you need to be aware that the SubItems need to be added for each item. It is possible to have say 5 columns and only 3 subitems for an item. The missing subitems are null and may generate an exception.
|
|
|
|
|
Thanks!!!
|
|
|
|
|
Give this a try:
ListViewItem lst1 = new ListViewItem(str, 0);
listView1.Items.Add(lst1);
modified 27-May-14 5:11am.
|
|
|
|
|
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form.
Thanks for your help!
|
|
|
|
|
I hear there's this new thing called a database...
(If the number of "objects" is small and steady, perhaps an XML file will suffice.)
|
|
|
|
|
You can store it in any storage location like DataBase, TextFile . When program is restarting read the content from the storage location.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Yeah, I pretty much feel like an idiot. I use a database for my asp.net apps, but for some reason it never occurred to me to use it for a windows form app. Anyway, thanks for the answer.
|
|
|
|
|
Ok so you have just added a new definition to not "thinking outside the box" - note the joke icon, this made me chuckle.
|
|
|
|
|
If those options are global or per user (application user), the best place to store them is a database; if the options are per machine, store them in a custom xml file.
|
|
|
|
|
If your list is something that can be thought of as application settings , put it there. The application settings are easy to manage.
Try to use but not abuse data bases (not even xml file dbs)
|
|
|
|
|
Hi, u can use resource file, as they are part of application and not stored outside of it. u can access them using stream when required, conditionally prices dont change often.if u use this u dont need DB and not even shared variables.
Avinash S. Godse
|
|
|
|
|
hello all.
I want to validate category name before insert all information about category into database.
The following condition is the way i want to compare:
Ex: ------------------------------------------------------------------------
| name in TblCategory | name in Text box | comparative result |
------------------------------------------------------------------------
| white bag | whitebag | existing |
------------------------------------------------------------------------
| whitebag | white bag | existing |
------------------------------------------------------------------------
| White Bag | white bag | existing |
------------------------------------------------------------------------
I use this following function in sql database:
BEGIN
IF EXISTS(SELECT TOP 1 *
FROM TblCategory c
WHERE (c.c_name=@name OR c.c_name=REPLACE(@name,' ',''))
AND c.c_id <> @id
)
SET @result=1
ELSE
SET @result =0
END
this give me bad result if TblCategory (white bag) and TextBox to compare has word(whitbag)...this can't compare to me
|
|
|
|