|
Hi,
How can Convert 0x10 to Integer.
Actually my mean is this what is the real value of 0x10 in integer(dacimal) format.And what is the formula behind it.
ThanksIf you can think then I Can.
modified on Wednesday, February 24, 2010 3:25 AM
|
|
|
|
|
The VB way to write hex numbers is to use the prefix "&H".
consider this example:
Dim hexNumber As String
Dim hexValue As Integer
hexNumber = "&H10"
hexValue = Microsoft.VisualBasic.Conversion.Int(hexNumber)
MessageBox.Show(hexValue)
|
|
|
|
|
You just need to use the Convert class. i.e txtResult.Text = Convert.ToDecimal("0x10", 16) . The firat parameter is your Hex figure as a string, and the second parameter is the base to whch you want to convert from(can only be 2,8,10,16). Convert also has different functions to convert to int16, int32, short, long etc. Just type Convert. and intellisense will give you all the options.
|
|
|
|
|
please could you explain more? I can´t get your method to work
|
|
|
|
|
My apologies, Convert only converts from one base to another as an integer i.e. the ToInt16, ToInt32 or ToByte Functions have the fromBase Overload.
|
|
|
|
|
|
Each digit, counting from right to left, is a multiple of 16 to the power of that digit's position. So counting digits of the number 0x1234 as position 3210 for example we have
1 * 16^3 + 2 * 16^2 + 3 * 16^1 + 4 * 16^0 or
1 * 4096 + 2 * 256 + 3 * 16 + 4 * 1 etc
and your value 0x10 = 1 * 16^1 + 0 * 16^0 = 1 * 16 + 0 = 16txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thank u every body. If you can think then I Can.
|
|
|
|
|
If you remove the "0x" from the front of your string you can then use Int32 to parse it to an integer:
Dim str1 = "0x10"
Dim str2 = str1.Substring(2)
Dim i = Int32.Parse(str2, Globalization.NumberStyles.AllowHexSpecifier)
MsgBox("i = " & i)
Shows i = 16.
|
|
|
|
|
Hi,
So I have a column of cells that are the combination of a other cells in the row and a result of a few "if functions." The value comes out exactly as planned however in order for the data to be sent to the DDE server I need to press F2, go the beginning of the cell to insert an "=" sign and then press enter. I would like a macro to do what I just mentioned and then go down to the cell in the column. I used to write code using C++, but I'm a little rusty and unfamiliar with VB. Below is the formula and then the result of the cell. Any information or suggestions would be greatly appreciated!
=(IF(G10>0,"=ANVDdeSrv|"&B10&"!SendOrder"&L10&"NYSE_"&ABS(G10)&"_1_100_"&M10,IF(G10<0,"=ANVDdeSrv|"&B10&"!SendOrder"&L10&"NYSE_"&ABS(G10)&"_1_100_"&N10,)))
ANVDdeSrv|AMD!SendOrder_Sell_NYSE_300_1_100_3.3
|
|
|
|
|
Turn on macro recording, perform the actions, turn off macro recording and Robert is your father's brother.
|
|
|
|
|
Hello Fellow Programmers,
I have a treeview with treenodes holding an object.
When the Treeview is closed I wan't to properly dispose all objects inside all Treenodes.
The memory usage keeps growing.
I've added the dispose interface but I don't know how to trigger the event.
There is no event inside a treenode class that is triggert when the treeview is closed.
Or is there?
Public Class MenuTreeNode
Inherits TreeNode
Implements IDisposable
private m_Menu as menu
end class
I solved the problem to add the dispose handler from all treenodes to the treeview.HandleDestroyed event
All treenodes are now cleaned up when the handle is Destroyed.
Is this a good approach?
Thanks in Advancemodified on Tuesday, February 23, 2010 2:47 AM
|
|
|
|
|
Are you disposing of objects when the TreeNode is collapsed or you're trying to dispose of them when the TreeView goes out of scope when the Form it's on dies?
|
|
|
|
|
Dave,
I'm disposing the objects when the form is disposing and the treeview goes out of scope.
|
|
|
|
|
Do any of your custom TreeNode objects hold onto unmanaged resources??
Right now, i don't see why you implemented Dispose on a TreeNode object. Why did you think you needed to do this?
|
|
|
|
|
I don't use unmanaged resources in my custom treenodes
I think you meen that the garbage collector will cleanup the memory.
Even the extra objects that are declared inside the treenode.
I just wanted to make sure that all objects in the treenodes
are disposed before closing the treeview.
|
|
|
|
|
andre de jong wrote: I think you meen that the garbage collector will cleanup the memory.
Even the extra objects that are declared inside the treenode.
If they are managed objects (.NET code,) yes, it will.
andre de jong wrote: I just wanted to make sure that all objects in the treenodes
are disposed before closing the treeview
They'll be disposed and unusable, but they won't be destroyed until the GC gets around to collecting them.
Again, what makes you think you need to do this?
|
|
|
|
|
optimize garbage collection
|
|
|
|
|
You're actually hurting it, not optimizing it.
The Dispose method does NOT determine when the GC collects an object and frees memory. All Dispose does is give your object a chance to release resources that the GC cannot do itself, such as releaseing unmanaged handles to GDI objects, unmanaged memory allocations, ... Dispose does NOT in any way determine when an object is collected and its memory returned to the managed heap.
Again, why are you doing this? What makes you think you need to "optimize" garbage collection?
|
|
|
|
|
hello all
how can i check that sqlserver is install in server or not??? i create a setup file that install msde. and i want if sql is installed in system msde not install...
can you help me please?M.Alizadeh
modified on Tuesday, February 23, 2010 3:06 AM
|
|
|
|
|
Check if SQL Server exists in the computer services.
|
|
|
|
|
MSDE!? not SQL Server Express?
For MSDE have a look at SQLDMO.DLL. If you are using Express then look at the SMO library, which is the .NET replacement for SQLDMOSteve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I'd like to start learning programming, which language should I start with for a beginner like me?
neothematrix
|
|
|
|
|
I doubt this was the right place to post this question - but I would say Visual Basic or C# would be the easiest to learn. Java would also be good to learn as it is multi-platform. If you want to fully understand computing languages though, learn C++ (or C). Its a more difficult language, but much more powerful, and if you can understand that language, other languages like VB and Java will make more sense. I started off learning VB6 and while I learned that quickly, when I started trying to learn C I was really confused!
|
|
|
|
|
Thank you. What do you think about Visual Basic Express Edition vs Visual Basic 6.0?
|
|
|
|