Reverse Casting \ Single Back To Double?

Mar 30, 2010

Reverse casting? Single back to Double

View 5 Replies


ADVERTISEMENT

Reverse Casting - Single Back To Double?

Nov 10, 2011

I wanted to know if it's possible - after casting a double to a single, to turn it back into a double again? i tried doing something like:

Dim x_double as double = 12345678.987654321d
Dim x_single as single=x_double
x_doubble=Cdbl(x_single)

but it doesn't give me the original value.

View 2 Replies

[2008] Casting Double To Integer?

Feb 5, 2009

I'm trying to write a (WPF) program with Option Strict on, but I have a problem.
I have a Canvas with a background image, and I want to use the coordinates of where the canvas was clicked to determine what should happen next. (Something like this)

Dim p As Point = e.GetPosition(DirectCast(sender, Canvas))
Dim imgColorMap As System.Drawing.Bitmap = My.Resources.ColorMap
Dim c As System.Drawing.Color = imgColorMap.GetPixel(p.X, p.Y)

This gives me the error: "Option Strict disallows implicit conversion of 'Double' to 'Integer'" for p.X and p.Y I have tried several things, like Math.Round but strangely enough that also returns a double.

How do I cast/round these Double values to Integer, so I can use them in my GetPixel method?

View 3 Replies

Casting An Integer To A Single, Preserving Bit Representation?

Jun 24, 2011

Is there a fast way in VB.NET to take a 32-bit int and cast to a 32-bit float while preserving the underlying bit structure? BitConverter will do this, but I'd like to cast it directly without involving byte arrays.

View 1 Replies

Reverse This Algorithm To Get Back The Original Text?

Aug 22, 2010

Can anyone please explain with the easy coding how to reverse this algorithm so that I get back the original text string?

Public Function CreateIntChecksum(ByVal s As String) As Integer
Dim r As Integer = 0
For i As Integer = 0 To (s.Length() - 1)

[code].....

View 6 Replies

Intercept Single Or Double Mouse Click - Only Execute Double Click Code On Double Click?

Jan 27, 2011

I have a situation where I am handling both single & double mouse click events on a form. In both cases something has to be loaded, however when a double click occurs, I do not wish to execute the code attached to the single click event.Is there a way to intercept the mouse click's and check if double or single and then execute the right event appropriately?

View 2 Replies

Casting - Convert A String With Value "22.882" To Double?

Aug 18, 2010

Why is it that when I convert a string with value "22.882" to double, using Dbl() it loses precision and is converted to 2288.2?

I have to use a double since I'm using the constructor of System.Web.UI.WebControls.Unit[URL]..

View 3 Replies

Converting A String To Double And Back

Feb 24, 2012

I am storing a value (represented as a string originally) like this -2345678901234.12345678912 - in a double variable. After storing, it is represented in an exponential format (with an e). How do i convert this exponential representation to the original(string) representation?

[Code]...

View 1 Replies

Comparing A Single To A Double?

Oct 19, 2010

Here's my test code:

Dim testSingle As Single = 7.2
Dim testSingleF As Single = 7.2F
Dim testDouble As Double = 7.2

[code].....

View 2 Replies

C# - Convert MBF Single And Double To IEEE?

Jun 4, 2010

Follow-Up available: There's a follow-up with further details, see Convert MBF to IEEE.

I've got some legacy data which is still in use, reading the binary files is not the problem, the number format is. All floating point numbers are saved in MBF format (Single and Double). I've found a topic about that on the MSDN boards but that one only deals with Single values. I'd also would like to stay away from API-Calls as far as I can.

Edit: Just in case somebody needs it, here is the VB.NET Code (it's Option Strict compliant) I ended up with (feel free to convert it to C# and edit it in):

''' <summary>Converts a MBF Single to an IEEE Single</summary>
''' <param name="src">The MBF Single value</param>
''' <returns>The converted IEEE Single value</returns>

[Code]...

View 2 Replies

Double And Single Quotes In String?

May 12, 2009

I have a problem with double and single quotes in a string.I have a textbox where i take a string from.In the textbox are double quotes and single quotes quotes.Problem is that if i return the string all the single quotes are replaced by double quotes.How can i get it to keep the single quotes as single quotes?

View 4 Replies

Implicit Conversion From Double To Single

Jun 13, 2011

[Code]...

The code compiles and seems to run correctly, but is underlined with the message "Implicit Conversion from 'Double' to 'Single'" Why would this be an implicit conversion if each of the variables is cast as a Single? Is this something I should worry about or change?

View 2 Replies

Put A Single Double Quote As A String?

Mar 15, 2011

It would seem to be Dim MyString as String = """""" but VB doesn't like that.

View 2 Replies

Check Single And Double Bytes Character?

Feb 16, 2011

How to check the Single byte character (e.g. English) and Double bytes character(e.g. Chinese) ?

Since I want to printing out their code which are representing in Hex.

However, Single byte character is using 2 digits of Hex. And Double bytes character is using 4 digits of Hex.

So, how can I check them and output with more readable pattern ?

input likes: 微軟 Microsoft output likes: B74C B36E 4D 69 63 72 6F 73 6F 66 74

View 1 Replies

ExecuteScaler - Bringing Back Single Value (Date)

Oct 15, 2009

I have the following query that should be bringing back a single date, however, it is bringing back the first date in the table, completely ignoring the Where clause.

'Get days pending
Dim AgePC As String
Dim sSQL As String = "SELECT [DateStamp] FROM [Activities] WHERE "
sSQL &= "[ClaimNo] = '" & Me.txtClaimNum.Text & "' AND [Activity] = 'PCAC' OR 'PCTE'"
Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim com As New System.Data.OleDb.OleDbCommand(sSQL, conn)
Try
conn.Open()
[Code] .....

View 10 Replies

Access Single Bytes That Form A Double Variable?

Sep 20, 2009

How can I get access in a fast way to the single bytes that form a double variable?

In pseudo-code I want to do something like this:

Dim myDouble as Double
Dim myArray(7) as Byte
myArray = myDouble

'continue doing things with the single bytes

The code is meant for use in a I/O-handler. The double-variables have to be sent / received via TCP. For this purpose they shall be put into / assembled from I/O-buffers.

View 2 Replies

Saving A Text Field That May Contain A Single Of Double Quote?

Jun 16, 2010

I am saving a text field that may contain a single of double quote.' or "If i use a double quote in my SQL save funciton I can save and use single Quotes. When I use a Single quote I can save Double Quotes. Yet not both.People use both, so I would like to know how I could change the delimiter to something other than a Double Quote for my text saves

View 3 Replies

Reverse A String Of Words Without Using The Reverse Function?

Apr 5, 2010

I need to reverse a string of words without using the reverse function. This is what I have so far, BUT it only shows the last two letters. For example: if i type "John" it will only give me "ho"

Public Class frmReverse
Dim original As String
Dim New1 As String

[code]....

I need to this without using things we haven't seen in class.

View 3 Replies

Calculator Application - Use Datatype - Variables Be Single Double Decimal ?

Mar 11, 2009

I am writing an calculator application and i dont know what datatype to use. i mean should the variables be single, double, decimal...?

View 1 Replies

Set Folder Options Single Or Double Click To Open Item?

Nov 4, 2010

I would like to be able to set the following settings in the folder options:

- single click to open an item
- double click to open an item

I am using Visual basic 2008 Express edition.

View 2 Replies

VS 2008 - Option Strict Continued - Gives Me The Going From Double To A Single Error

Oct 13, 2009

Quick code example:

v1.magnitude = myVectors(c).magnitude * 0.95

I have a vector class...and the magnitude is single precision...Now the problem is this, when I run this with option strict on, it gives me the going from double to a single error...Why? Does multiplication imply double precision?

So with option strict on, can you not multiply single precision numbers together and assign them to another single precision variable without first convert.tosingle?

What is the point of this? I am currently changing hundreds of lines of code in a project that runs perfectly...

View 22 Replies

VS 2008 - Change Back Color Of Single Cell In DataGridView

Feb 8, 2010

How I can change the back color of a single cell of a datagridview in runtime?

View 1 Replies

Convert Single Precision Floating Point Numbers To IEEE 754 Hex And Back?

Aug 12, 2009

Private Function SingleToIEEE754Hex(ByVal pValue As Single) As String

[Code]...

View 1 Replies

2 Listviews & 4 Textboxes Giving Error When Double Clicking On Textbox2 Replacing Data Back-listview2

Jan 16, 2012

I have an ArgumentException was unhandled message: Cannot add or insert the item '1' in more than one place. You must first remove it from its current location or close it. Parameter name item. Note: Have 2 listboxes 4 textboxes double click listbox2 and it fills in the four texboxes (now it needs to put it back into listbox2 in the same place it came from but crashes. I marked the area and underlined where the error message was coming up. So double click a selection in listview2 (fills 4 textboxes) then double click textbox2 (should return text data back to listview2 in same spot) but crashes. See code below.

[Code]...

View 2 Replies

Read A Single Column Array From Bottom Up, Then Back Down, Filled With Decimal's, Into One Line Separated By Comma's?

Jun 14, 2011

Does anyone know how to read a single column array from bottom up, then back down, filled with decimal data, into one line seperated by comma's?

a = 0
Do Until a > decArray.Length - 1
test = decArray(a)

[code]....

View 1 Replies

Created A Button Control - Change Into Single Click Insted Of Double Click ?

Feb 26, 2010

I created a button control ,, by double clicking only the process was going on,,when iam single click the button nothing is to be happenend,,so i want to change into single click insted of double click........here my coding is given below.......

<asp:Button ID="getrec" UseSubmitbehavior ="false" runat="server" Style="left: 30px; position: relative; top: 0px; z-index: 101;"
Text="Get Record" />

[CODE]...

Here the coding is all are correct but the problem is when double clicking the button only it was worked ,,,iwant want to change it into single click

View 1 Replies

C# - Using SelectNodes With Attribute Having Single Quotes And Double Quotes?

Nov 9, 2011

Is there any way to use selectnode with the attribute having both single and double quotes? If we are having single quote in the attribute we can use like below,

nodeList = root.SelectNodes("//book[contains(title,""'attribute'"")]")

If we are having double quotes we can use,

nodeList = root.SelectNodes("//book[contains(title,'"""attribute"""')]")

how can I use an attribute ['attribute"] having both single and quotes in SelectNodes.

View 1 Replies

Call Double Click On Mouse Single Click?

Mar 11, 2012

how do we call double click on single mouse click event? Iam doing this and it's not working.

Private Sub RichTextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick
RichTextBox1_MouseDoubleClick(sender, e)
End Sub

View 3 Replies

Double Click Firing On Single Click In Grid?

Jun 24, 2010

I have a grid that displays data from a binding source. I have a method to handle the CellContentDoubleClick which will get the value of the cell and use that to do a new look up. This will generate a new datasource (with different columns) which I then rebind to the grid.

My grid double click works, but when it repaints with the new data, a single click fires the double click. I have no code in place to handle a single click .

The interesting thing is that it is (in my case) a toggle. If I double click, on the repaint, a single click fires the double click code. When it repaints again, I need a double click .

The double click code fires off a messagebox - if I tell it not to continue, then I have to double click to get it to fire again. So it is not dependant on what data is displayed.

View 9 Replies

Grid Double Click Fires On Single Click?

Jun 24, 2010

I have a grid that displays data from a binding source. I have a method to handle the CellContentDoubleClick which will get the value of the cell and use that to do a new look up. This will generate a new datasource (with different columns) which I then rebind to the grid.

My grid double click works, but when it repaints with the new data, a single click fires the double click. This happens whether or not thre is a single click handler.

The interesting thing is that it is (in my case) a toggle. If I double click, on the repaint, a single click fires the double click code. When it repaints again, I need a double click.

The double click code fires off a messagebox - if I tell it not to continue, then I have to double click to get it to fire again. So it is not dependant on what data is displayed.

When it is in the mode to respond to a single click, I can tab through all the controls and then click on any cell in the grid and it will still fire the double click.

No matter what I try to do (set focus to other controls, refresh the grid, etc.) nothing seems to reset the grid so it works consistently.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved