|
I can't see any way in which form B can access form A without you providing form B with a reference to form A's instance.
If you want form B to access form A just pass it as a refernce in form B's constructor.
However, a better desgin would be as follows:
1. Let form B get all the information it should.
2. Once the user clicks on the OK button, close the form.
3. Form A will access the information defined in form B using form B's getters.
4. Problem solved.
In most cases, it is not wise to create coupling between forms. And it is also not recommended that a dialog will update its caller, since dialogs usually allow the users to cancel, it is not wise to change things while the dialog is still open since the user can cancel and you will need to rollback the changes.
Hope that answers your question
|
|
|
|
|
Your first idea to pass a reference to form a when creating form b is what i tried first of all but its not possible to send it as an reference because of this problem:
"Cannot pass '<this>' as a ref or out argument because it is read-only"
Is there anyway to get around this?
Anohter way to just pass the items that form b needs from form a would be a very ugly and bad solution since whats updated involves ~100 components and id rather not try to group them all together into one object and pass if possible.
"In most cases, it is not wise to create coupling between forms. And it is also not recommended that a dialog will update its caller, since dialogs usually allow the users to cancel"
In most cases, yes, i agree, but this is special.
Let me explain this a bit further.
Form A contains a "sheet" loaded from a database and the information is shown in textboxes. Form B is a search function which searches through the whole database after the users search parameter/criteria and displays a list of all found matches. When you click an item in the list the main view should load this automatically and form B should leave itself open so that the user can browse the next result without having to open form b again and do the same search over and over.
|
|
|
|
|
If you specify the parameter as ref, you pass a reference to the reference. Just pass the reference without ref.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot!
That did the trick.
|
|
|
|
|
Hi All!
I have installed an assembly (say A1.dll) in the GAC. A1.dll has a dependancy A2.dll. A2.dll has also been installed in the GAC. A2.dll in turn has a dependancy A3.dll. A3.dll has also been installed in the GAC. Now, I need to use A1.dll in a windows application. I add a reference to A1.dll (Copy Local = false). The application builds without errors. Now, when I run the application, the runtime locates A1.dll and A2.dll from the GAC successfully, but fails to locate A3.dll and a FileNotFound Exception is thrown. I wonder why the assembly is not being located by the runtime when it has been installed in the GAC. I havent touched any configuration file which could have overriden the version reference. Can anyone help me find a clue to this problem?
Regards!!!
|
|
|
|
|
I'm using THE api(SendMessage or PostMessage) to send a custom message between 2 C# exe's. The called exe is subclassed to listen to the custom message. In the calling exe, I'm trying to pass a string in the 4th parameter. At this stage the 2nd exe is already running. The api call keeps crashing the 2nd exe. Can it be done across exe's or only within the same exe, thanks.
help me ,please thanks
contract me :enet2008@hotmail.com
you are welcome to visit my blog
|
|
|
|
|
Using SendMessage API to control external app:
have an external application that I need to be able to control. I've tried using SendKeys but due to the obvious limitations of this function the behavior is erratic. I know you can do this using the SendMessage API ( find the handle of the external application's window ,first ) ,but I'm not sure how to do it.
can you provide the sameple code to me ,please?
you are welcome to visit my blog
|
|
|
|
|
You'd be much better off using Remoting.
You can't send a String in a message like this, only a pointer to where in memory it is. The problem is the memory from one application is not accessible to another without jumping through flaming hoops.
But, here[^] is a thread that seems to have had some success at it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I can do it now
I can use FindWindow,GetWindow and SendMessage to send message to a notepad app,just like this:
hWnd1 = FindWindow(null, "Untitled - Notepad");
hWnd2 = GetWindow(hWnd1, GW_CHILD);
sText =this.textBox1.Text;
SendMessage (hWnd2, WM_SETTEXT,sText.Length, sText);
but I don't know how to excute a word app's dictate by another app,help me please ,thank you!
you are welcome to visit my blog
|
|
|
|
|
I was wondering if there is a way to write to the extended file properties in Wdindows. I know how to read them from a file.
For instance if I wanted to get the Artist's Name in a mp3 file I would use the GetDetailsOf method from the Shell32 object. I would do GetDetailsOf(folderItem,9) to get the value of the artist name.
However there is no "SetDetailsOf(.....)". I want to write a program to set those extended file properties to whatever I please. Is there any way to do this??? There must be a way. Any help would be greatly appreciated.
Thanks,
Matt
|
|
|
|
|
I have an app im developing that accesses a web site (Thanx to Adn Brummer for helping with that part), i new want to access a different area of that web site (that has its own URL), essentially i have a page that lists numerous documents, i want to send a POST to be able to get the properties of a specific document. i have sent the POST (got the commands to send from Fiddler) and i keep getting a "Session Timed Out" message (amongst the HTML code), but this does not happen when i access the site online (via IE).
the following is the command i am sending to access wat i want.
offset=0&resultRowBlockSize=12&matrixColSpan=4&show=thumbnail&targetDocId=31242&displayedDocIds=31242&selectFlags=false&displayedDocIds=31240&selectFlags=false&displayedDocIds=31238&selectFlags=false&displayedDocIds=31236&selectFlags=false&displayedDocIds=31234&selectFlags=false&displayedDocIds=31232&selectFlags=false&displayedDocIds=31230&selectFlags=false&displayedDocIds=31228&selectFlags=false&displayedDocIds=31226&selectFlags=false&displayedDocIds=31224&selectFlags=false&displayedDocIds=31222&selectFlags=false&displayedDocIds=31220&selectFlags=false&orderBy_property=ReceivedDate&orderBy_descendingRequested=true&dummy=
can anyone help me with this (if u need more info, or code snippets, let me know)
|
|
|
|
|
This is probably happening because you are not returning a session cookie that you received from a previous GET. Once you receive a session cookie you must return it with every HTTP GET or POST to that web site. Take a look at the Cookies property in the HTTPRequest class that I'm sure you are using.
|
|
|
|
|
Thanx, ill have a look at that, i did come across the fact that it was applyin a different session ID when i called my POST.
im storing all the cookies i get (as far as i know) into a global Cookie collection, that seems to have a COOKIE with the name of risessionid, but im not sure what to do with it.(sorry about these, im new to web development)
i also noticed that the Id works fine, as long as the URL of my page doesnt change, i have a page that lists documents, and if u scroll through the list, the page changes but the URL doesnt, but the second i change the URL it doesnt work.
-- modified at 18:43 Wednesday 14th September, 2005
|
|
|
|
|
Its ok now, i managed to get it to work, i jsut simply created a Cookie object and assigned the Session Id cookie to this object, not it all works perfectly, thanx for the help, and pointing me on the right path
thanx
|
|
|
|
|
Hi
I have doen a program, her is some part of the coding
DateTime current = System.DateTime.Now;
DateTime end = DateTime.Parse(textBox1.Text);
TimeSpan ts = current.Subtract(end);
I am calculating as follows. But now i want to know the default format of dateTime.
in texBox1.text, i will give a time.... then that sould be calculated fromteh current time of teh system.
so i want to give only the time like 3:00 ..i mean in hrs and minutes....
so how do i format these.
pls help me to do this .
dhol
|
|
|
|
|
Try this[^]
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi I have done a program using system.threading.timer....
now in that i will input the time in a textbox, say 03:00 pm..
now i have to format in that way, i mean hour:minute..
here is the part of my coding
//system timing
DateTime current = System.DateTime.Now;
//texbox,wher i wil give time
DateTime end = DateTime.Parse(textBox1.Text);
.//then i willcalculate the timespan.
TimeSpan ts = current.Subtract(end);
but only in the second part of my coding. i willgive as 03:00 pm in the textbox,which should be accepted.
so please help me how to format the datetime.
I read from MSDN and articles to use
{t}
, but i dont know exactly how to implement.. so please help me by explaining how to code that part..
js---ie, hour:minute wise...
so that if i give 05:30pm should be able to accept and calculate the timespan.
so please can anyone help me to solve this issue.
js
|
|
|
|
|
Hi
I want to get data from Access instead of notepad.
Here are the codes to get data from notepad by entering IC number (equivalent to ID number). The records are stored in 'Folder'.
<br />
public void btnGo_Click_1(object sender, System.EventArgs e)
{<br />
enable(); <br />
<br />
strFileName2 = tboxEnterICNo.Text;<br />
path = @"Folder\"+strFileName2+".txt";<br />
<br />
if(File.Exists("Folder\\"+strFileName2+".txt"))
{<br />
displaygraph.names = path;
displaygraph.ShowDialog();
}
else<br />
{<br />
MessageBox.Show("File does not exist! Please create a new profile.", "Invalid File Type", MessageBoxButtons.OK, MessageBoxIcon.Error );<br />
}
}
How should i go about to keep the records in Access and also specify retrieving of the queried data from an Access table instead?
I need some help about what to do and how the codes look like.
Thank you very much!
|
|
|
|
|
You've been loading text files, and you want to move to an Access DB ? If you google[^] C# Access Database, you get heaps of links to articles on this sort of thing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi there,
if u need to keep the records in Access DB, u need to have basic knowledge of mechanism of accessing to Access DB, such as: ODBC, OleDB, ADO or ADO.NET.
u can get more detail and also simple codes from MSDN
To query from Access DB, u also need to know SQL query. This can be got from SQL Book Online
<< >>
|
|
|
|
|
Hi hi,
If it's using oledbadapter and dataset, i know how to use them and query for data from Access.
However, what i need now is how do i automatically store the data downloaded into Access instead of storing in Notepad?
How do i get every set of downloaded data to append to my Access db table??
Thank you!!
|
|
|
|
|
after u downloaded data need to be stored into Access DB, u can use sql query that is something like "insert into ur table(field1, field2,..) values (...)" to insert the data into Access DB
<< >>
|
|
|
|
|
See the FunA() and FunB() result, why any diffent?
<br />
private void FunA()<br />
{<br />
double value;<br />
System.Text.StringBuilder sb = new System.Text.StringBuilder();<br />
for( value = 2.1; value >= -1.1; value -= 0.1 )<br />
sb.AppendFormat("Ceiling({0:f})={1} Floor({0:f})={2} Round({0:f})={3} (int)({0:f}+0.5)={4} Truncate({0:f})={5}\n", value, Math.Ceiling(value), Math.Floor(value), Math.Round(value), (int)(value+0.5), Decimal.Truncate(Convert.ToDecimal(value)));<br />
return sb.ToString();<br />
}<br />
private string FunB()<br />
{<br />
double value;<br />
System.Text.StringBuilder sb = new System.Text.StringBuilder();<br />
for( value = 5.1; value >= -1.1; value -= 0.1 )<br />
sb.AppendFormat("Ceiling({0:f})={1} Floor({0:f})={2} Round({0:f})={3} (int)({0:f}+0.5)={4} Truncate({0:f})={5}\n", value, Math.Ceiling(value), Math.Floor(value), Math.Round(value), (int)(value+0.5), Decimal.Truncate(Convert.ToDecimal(value)));<br />
return sb.ToString();<br />
}<br />
Reuslts is:
FunA():
Ceiling(2.10)=3 Floor(2.10)=2 Round(2.10)=2 (int)(2.10+0.5)=2 Truncate(2.10)=2
Ceiling(2.00)=2 Floor(2.00)=2 Round(2.00)=2 (int)(2.00+0.5)=2 Truncate(2.00)=2
Ceiling(1.90)=2 Floor(1.90)=1 Round(1.90)=2 (int)(1.90+0.5)=2 Truncate(1.90)=1
Ceiling(1.80)=2 Floor(1.80)=1 Round(1.80)=2 (int)(1.80+0.5)=2 Truncate(1.80)=1
Ceiling(1.70)=2 Floor(1.70)=1 Round(1.70)=2 (int)(1.70+0.5)=2 Truncate(1.70)=1
Ceiling(1.60)=2 Floor(1.60)=1 Round(1.60)=2 (int)(1.60+0.5)=2 Truncate(1.60)=1
Ceiling(1.50)=2 Floor(1.50)=1 Round(1.50)=1 (int)(1.50+0.5)=1 Truncate(1.50)=1
Ceiling(1.40)=2 Floor(1.40)=1 Round(1.40)=1 (int)(1.40+0.5)=1 Truncate(1.40)=1
Ceiling(1.30)=2 Floor(1.30)=1 Round(1.30)=1 (int)(1.30+0.5)=1 Truncate(1.30)=1
Ceiling(1.20)=2 Floor(1.20)=1 Round(1.20)=1 (int)(1.20+0.5)=1 Truncate(1.20)=1
Ceiling(1.10)=2 Floor(1.10)=1 Round(1.10)=1 (int)(1.10+0.5)=1 Truncate(1.10)=1
Ceiling(1.00)=1 Floor(1.00)=0 Round(1.00)=1 (int)(1.00+0.5)=1 Truncate(1.00)=0
Ceiling(0.90)=1 Floor(0.90)=0 Round(0.90)=1 (int)(0.90+0.5)=1 Truncate(0.90)=0
Ceiling(0.80)=1 Floor(0.80)=0 Round(0.80)=1 (int)(0.80+0.5)=1 Truncate(0.80)=0
Ceiling(0.70)=1 Floor(0.70)=0 Round(0.70)=1 (int)(0.70+0.5)=1 Truncate(0.70)=0
Ceiling(0.60)=1 Floor(0.60)=0 Round(0.60)=1 (int)(0.60+0.5)=1 Truncate(0.60)=0
Ceiling(0.50)=1 Floor(0.50)=0 Round(0.50)=0 (int)(0.50+0.5)=0 Truncate(0.50)=0
Ceiling(0.40)=1 Floor(0.40)=0 Round(0.40)=0 (int)(0.40+0.5)=0 Truncate(0.40)=0
Ceiling(0.30)=1 Floor(0.30)=0 Round(0.30)=0 (int)(0.30+0.5)=0 Truncate(0.30)=0
Ceiling(0.20)=1 Floor(0.20)=0 Round(0.20)=0 (int)(0.20+0.5)=0 Truncate(0.20)=0
Ceiling(0.10)=1 Floor(0.10)=0 Round(0.10)=0 (int)(0.10+0.5)=0 Truncate(0.10)=0
Ceiling(0.00)=0 Floor(0.00)=-1 Round(0.00)=0 (int)(0.00+0.5)=0 Truncate(0.00)=0
Ceiling(-0.10)=0 Floor(-0.10)=-1 Round(-0.10)=0 (int)(-0.10+0.5)=0 Truncate(-0.10)=0
Ceiling(-0.20)=0 Floor(-0.20)=-1 Round(-0.20)=0 (int)(-0.20+0.5)=0 Truncate(-0.20)=0
Ceiling(-0.30)=0 Floor(-0.30)=-1 Round(-0.30)=0 (int)(-0.30+0.5)=0 Truncate(-0.30)=0
Ceiling(-0.40)=0 Floor(-0.40)=-1 Round(-0.40)=0 (int)(-0.40+0.5)=0 Truncate(-0.40)=0
Ceiling(-0.50)=0 Floor(-0.50)=-1 Round(-0.50)=-1 (int)(-0.50+0.5)=0 Truncate(-0.50)=0
Ceiling(-0.60)=0 Floor(-0.60)=-1 Round(-0.60)=-1 (int)(-0.60+0.5)=0 Truncate(-0.60)=0
Ceiling(-0.70)=0 Floor(-0.70)=-1 Round(-0.70)=-1 (int)(-0.70+0.5)=0 Truncate(-0.70)=0
Ceiling(-0.80)=0 Floor(-0.80)=-1 Round(-0.80)=-1 (int)(-0.80+0.5)=0 Truncate(-0.80)=0
Ceiling(-0.90)=0 Floor(-0.90)=-1 Round(-0.90)=-1 (int)(-0.90+0.5)=0 Truncate(-0.90)=0
Ceiling(-1.00)=-1 Floor(-1.00)=-2 Round(-1.00)=-1 (int)(-1.00+0.5)=0 Truncate(-1.00)=-1
FuncB():
Ceiling(5.10)=6 Floor(5.10)=5 Round(5.10)=5 (int)(5.10+0.5)=5 Truncate(5.10)=5
Ceiling(5.00)=5 Floor(5.00)=5 Round(5.00)=5 (int)(5.00+0.5)=5 Truncate(5.00)=5
Ceiling(4.90)=5 Floor(4.90)=4 Round(4.90)=5 (int)(4.90+0.5)=5 Truncate(4.90)=4
Ceiling(4.80)=5 Floor(4.80)=4 Round(4.80)=5 (int)(4.80+0.5)=5 Truncate(4.80)=4
Ceiling(4.70)=5 Floor(4.70)=4 Round(4.70)=5 (int)(4.70+0.5)=5 Truncate(4.70)=4
Ceiling(4.60)=5 Floor(4.60)=4 Round(4.60)=5 (int)(4.60+0.5)=5 Truncate(4.60)=4
Ceiling(4.50)=5 Floor(4.50)=4 Round(4.50)=5 (int)(4.50+0.5)=5 Truncate(4.50)=4
Ceiling(4.40)=5 Floor(4.40)=4 Round(4.40)=4 (int)(4.40+0.5)=4 Truncate(4.40)=4
Ceiling(4.30)=5 Floor(4.30)=4 Round(4.30)=4 (int)(4.30+0.5)=4 Truncate(4.30)=4
Ceiling(4.20)=5 Floor(4.20)=4 Round(4.20)=4 (int)(4.20+0.5)=4 Truncate(4.20)=4
Ceiling(4.10)=5 Floor(4.10)=4 Round(4.10)=4 (int)(4.10+0.5)=4 Truncate(4.10)=4
Ceiling(4.00)=5 Floor(4.00)=4 Round(4.00)=4 (int)(4.00+0.5)=4 Truncate(4.00)=4
Ceiling(3.90)=4 Floor(3.90)=3 Round(3.90)=4 (int)(3.90+0.5)=4 Truncate(3.90)=3
Ceiling(3.80)=4 Floor(3.80)=3 Round(3.80)=4 (int)(3.80+0.5)=4 Truncate(3.80)=3
Ceiling(3.70)=4 Floor(3.70)=3 Round(3.70)=4 (int)(3.70+0.5)=4 Truncate(3.70)=3
Ceiling(3.60)=4 Floor(3.60)=3 Round(3.60)=4 (int)(3.60+0.5)=4 Truncate(3.60)=3
Ceiling(3.50)=4 Floor(3.50)=3 Round(3.50)=4 (int)(3.50+0.5)=4 Truncate(3.50)=3
Ceiling(3.40)=4 Floor(3.40)=3 Round(3.40)=3 (int)(3.40+0.5)=3 Truncate(3.40)=3
Ceiling(3.30)=4 Floor(3.30)=3 Round(3.30)=3 (int)(3.30+0.5)=3 Truncate(3.30)=3
Ceiling(3.20)=4 Floor(3.20)=3 Round(3.20)=3 (int)(3.20+0.5)=3 Truncate(3.20)=3
Ceiling(3.10)=4 Floor(3.10)=3 Round(3.10)=3 (int)(3.10+0.5)=3 Truncate(3.10)=3
Ceiling(3.00)=4 Floor(3.00)=3 Round(3.00)=3 (int)(3.00+0.5)=3 Truncate(3.00)=3
Ceiling(2.90)=3 Floor(2.90)=2 Round(2.90)=3 (int)(2.90+0.5)=3 Truncate(2.90)=2
Ceiling(2.80)=3 Floor(2.80)=2 Round(2.80)=3 (int)(2.80+0.5)=3 Truncate(2.80)=2
Ceiling(2.70)=3 Floor(2.70)=2 Round(2.70)=3 (int)(2.70+0.5)=3 Truncate(2.70)=2
Ceiling(2.60)=3 Floor(2.60)=2 Round(2.60)=3 (int)(2.60+0.5)=3 Truncate(2.60)=2
Ceiling(2.50)=3 Floor(2.50)=2 Round(2.50)=3 (int)(2.50+0.5)=3 Truncate(2.50)=2
Ceiling(2.40)=3 Floor(2.40)=2 Round(2.40)=2 (int)(2.40+0.5)=2 Truncate(2.40)=2
Ceiling(2.30)=3 Floor(2.30)=2 Round(2.30)=2 (int)(2.30+0.5)=2 Truncate(2.30)=2
Ceiling(2.20)=3 Floor(2.20)=2 Round(2.20)=2 (int)(2.20+0.5)=2 Truncate(2.20)=2
Ceiling(2.10)=3 Floor(2.10)=2 Round(2.10)=2 (int)(2.10+0.5)=2 Truncate(2.10)=2
Ceiling(2.00)=3 Floor(2.00)=2 Round(2.00)=2 (int)(2.00+0.5)=2 Truncate(2.00)=2
Ceiling(1.90)=2 Floor(1.90)=1 Round(1.90)=2 (int)(1.90+0.5)=2 Truncate(1.90)=1
Ceiling(1.80)=2 Floor(1.80)=1 Round(1.80)=2 (int)(1.80+0.5)=2 Truncate(1.80)=1
Ceiling(1.70)=2 Floor(1.70)=1 Round(1.70)=2 (int)(1.70+0.5)=2 Truncate(1.70)=1
Ceiling(1.60)=2 Floor(1.60)=1 Round(1.60)=2 (int)(1.60+0.5)=2 Truncate(1.60)=1
Ceiling(1.50)=2 Floor(1.50)=1 Round(1.50)=2 (int)(1.50+0.5)=2 Truncate(1.50)=1
Ceiling(1.40)=2 Floor(1.40)=1 Round(1.40)=1 (int)(1.40+0.5)=1 Truncate(1.40)=1
Ceiling(1.30)=2 Floor(1.30)=1 Round(1.30)=1 (int)(1.30+0.5)=1 Truncate(1.30)=1
Ceiling(1.20)=2 Floor(1.20)=1 Round(1.20)=1 (int)(1.20+0.5)=1 Truncate(1.20)=1
Ceiling(1.10)=2 Floor(1.10)=1 Round(1.10)=1 (int)(1.10+0.5)=1 Truncate(1.10)=1
Ceiling(1.00)=2 Floor(1.00)=1 Round(1.00)=1 (int)(1.00+0.5)=1 Truncate(1.00)=1
Ceiling(0.90)=1 Floor(0.90)=0 Round(0.90)=1 (int)(0.90+0.5)=1 Truncate(0.90)=0
Ceiling(0.80)=1 Floor(0.80)=0 Round(0.80)=1 (int)(0.80+0.5)=1 Truncate(0.80)=0
Ceiling(0.70)=1 Floor(0.70)=0 Round(0.70)=1 (int)(0.70+0.5)=1 Truncate(0.70)=0
Ceiling(0.60)=1 Floor(0.60)=0 Round(0.60)=1 (int)(0.60+0.5)=1 Truncate(0.60)=0
Ceiling(0.50)=1 Floor(0.50)=0 Round(0.50)=1 (int)(0.50+0.5)=1 Truncate(0.50)=0
Ceiling(0.40)=1 Floor(0.40)=0 Round(0.40)=0 (int)(0.40+0.5)=0 Truncate(0.40)=0
Ceiling(0.30)=1 Floor(0.30)=0 Round(0.30)=0 (int)(0.30+0.5)=0 Truncate(0.30)=0
Ceiling(0.20)=1 Floor(0.20)=0 Round(0.20)=0 (int)(0.20+0.5)=0 Truncate(0.20)=0
Ceiling(0.10)=1 Floor(0.10)=0 Round(0.10)=0 (int)(0.10+0.5)=0 Truncate(0.10)=0
Ceiling(0.00)=1 Floor(0.00)=0 Round(0.00)=0 (int)(0.00+0.5)=0 Truncate(0.00)=0
Ceiling(-0.10)=0 Floor(-0.10)=-1 Round(-0.10)=0 (int)(-0.10+0.5)=0 Truncate(-0.10)=0
Ceiling(-0.20)=0 Floor(-0.20)=-1 Round(-0.20)=0 (int)(-0.20+0.5)=0 Truncate(-0.20)=0
Ceiling(-0.30)=0 Floor(-0.30)=-1 Round(-0.30)=0 (int)(-0.30+0.5)=0 Truncate(-0.30)=0
Ceiling(-0.40)=0 Floor(-0.40)=-1 Round(-0.40)=0 (int)(-0.40+0.5)=0 Truncate(-0.40)=0
Ceiling(-0.50)=0 Floor(-0.50)=-1 Round(-0.50)=0 (int)(-0.50+0.5)=0 Truncate(-0.50)=0
Ceiling(-0.60)=0 Floor(-0.60)=-1 Round(-0.60)=-1 (int)(-0.60+0.5)=0 Truncate(-0.60)=0
Ceiling(-0.70)=0 Floor(-0.70)=-1 Round(-0.70)=-1 (int)(-0.70+0.5)=0 Truncate(-0.70)=0
Ceiling(-0.80)=0 Floor(-0.80)=-1 Round(-0.80)=-1 (int)(-0.80+0.5)=0 Truncate(-0.80)=0
Ceiling(-0.90)=0 Floor(-0.90)=-1 Round(-0.90)=-1 (int)(-0.90+0.5)=0 Truncate(-0.90)=0
Ceiling(-1.00)=0 Floor(-1.00)=-1 Round(-1.00)=-1 (int)(-1.00+0.5)=0 Truncate(-1.00)=0
Ceiling(-1.10)=-1 Floor(-1.10)=-2 Round(-1.10)=-1 (int)(-1.10+0.5)=0 Truncate(-1.10)=-1
Diffrents are showed in bold font.
Why same procedure, only diffrent value of starter, but has many diffrent? Float is so wonder, how can i make it exact.
=== Game is power! ===
|
|
|
|
|
Use double or Decimal, they are more precise.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
It already is double!
=== Game is power! ===
|
|
|
|