Hello guys
i want get one value of my enum and then converted into hex
but i got a warning
Warning 1 Runtime errors might occur when converting 'String' to 'System.IFormatProvider'

for example

Public enum myenum
myvalue =0
end enum

sub mysub()

console.writeline( myenum.myvalue.tostring("X2"))

end sub

How can i do something like this?
also i have one function that return
Return hexvalue.ToString("X2")
is any problem with that?
give me your lights :)

Recommended Answers

All 3 Replies

Format String can be only "G", "g", "X", "x", "F", "f", "D" or "d".

console.writeline( myenum.myvalue.tostring("X"))

Format String can be only "G", "g", "X", "x", "F", "f", "D" or "d".

console.writeline( myenum.myvalue.tostring("X"))

thanks for your reply
yes it works only with "X" parameter but i want 2digits

i find one way to do this like this

[Enum].Format(GetType(myemum),myenum.myvalue , "X").Remove(0, 6)

ugly right??
is any other possible solution?

>ugly right??

No.

>is any other possible solution?

str=Convert.ToString(1000, 16)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.