หน้าแรก
 การบ้าน
  C/C++ new
  Java new
  Windows Phone
  แจ้งเรื่องที่ต้องการ
 บทความ
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 แบบเรียนฟรี
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 ซอร์สโค้ด
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 บริการจากเรา
  เปิดท้าย... ขายโค้ด
  Freeware
  อัตราค่าโฆษณา
  รายชื่อลูกค้า
  สถิติผู้เข้าเว็บ
 ดาว์นโหลด
 ค้นหาข้อมูล
 กระดานสนทนา
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
  อื่นๆ
 กระดานงาน
 ลิงค์เว็บ
 เกี่ยวกับผม
 อัตราค่าโฆษณา
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
โปรแกรมเบอร์ดี (BerDee)
โปรแกรมเบอร์ดี (Android)
เกมส์เป่ายิ้งฉุบ
เกมส์เป่ายิ้งฉุบ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ติดต่อสอบถามมาได้ตลอดนะ...
2015-07-29 13:35:58
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:33:54
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:32:51
  ติดต่อสอบถามเข้ามาได้นะ...
2014-01-06 12:47:38
  ถ้ายังหาคนสอนไม่ได้ ก็ลอ...
2013-07-06 01:04:37
  สนใจส่งขอบเขตมาคุยราคาก...
2013-03-24 18:54:20
  ถ้ายังไม่มีคนรับงานติดต...
2012-12-16 19:18:14
  สนใจคะ ติดต่อ 0905076277...
2012-11-12 11:07:46
  รับทำโปรเจ็คนักศึกษาหรื...
2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  มาส่อง...
2024-08-19 15:45:12
  ช่วยเขียนโปรเจค: การควบค...
2024-08-07 09:13:31
  เขียนโปรแกรมภาษาจาวา
1.โ...

2023-09-12 11:40:28
  ต้องลอง debug ดูเองครับ
ไล่...

2023-06-08 18:03:06
  ร้านค้าแห่งหนึ่ง จะต้องน...
2021-09-21 08:47:08
  จงเขียนโปรแกรมดำเนินการ...
2021-05-07 15:06:11
  จงเขียนโปรแกรมสำหรับคำน...
2021-03-09 14:21:45
  ขอดู...
2021-01-04 23:56:45
  ขอโค้ดเพื่อทำการเรียนกา...
2020-12-09 23:02:09
  แล้ว ?...
2020-12-09 10:56:34
  Homework comment
  ขอโฟชาร์ตของโปรแกรมคำนว...
2025-02-27 13:31:36
  เขียนโปรแกรมเพื่อรับค่า...
2022-02-24 10:45:17
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  โจทย์การบ้าน c++ เขียนรูปแ...
2020-04-06 11:01:33
  แบบนี้ขอเป็น ภาษา php หน่อย...
2019-09-18 14:36:34
  ผมไม่อยากให้คุณได้คะแนน...
2019-04-27 01:29:07
  อาจารย์เขาบอกแนวข้อสอบม...
2019-04-27 00:44:29
  ขอสอบถามการเขียน c++ ครับ เ...
2018-04-02 12:19:21
  โค้ดตัวอย่างศึกษาให้เข้...
2017-11-26 14:50:05
  Article comment
  เท่าที่อ่าน error คือพื้นที่...
2022-03-23 13:56:48
  เรียน สอบถามปัญหา กับ อ.คร...
2022-01-24 17:39:49
  ต้องการ ให้เขียน โปรแกรม ...
2019-12-09 11:39:58
  รับเขียน arx จาก vc++ 2017 ล็อคโปร...
2019-09-19 09:48:09
  ทำการ register ไฟล์ที่ชื่อ mswinsck.oc...
2019-09-17 14:05:56
  ใน vb 6 ไม่มี component winsock เลยค่ะ ส...
2019-09-03 10:31:02
  รบกวนขอสอบถามหน่อยนะครั...
2019-03-04 05:31:04
  สามารถนำตัวหนังสือจากภา...
2018-12-25 08:54:32
  มีcode ของ VB ไหมค่ะ ถ้ามีรบกว...
2017-09-28 16:50:02
  น่าจะได้ครับ ไม่เคยลอง
...

2017-07-11 09:59:35
  9Mcode comment

Link Exchange

อัตราค่าโฆษณา
 
 Webboard

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

กระทู้ #2798 [Vb] (จาก IP: 124.120.247.43)

ขอโค๊ด VB แปลงเลขทศนิยมเป็นเลขฐานสอง

อยากได้ code VB ที่สามารถแปลงเลขฐานสิบทศนิยมเป็นเลขฐานสองทศนิยมอะครับ คือต้องใช้ในโปรเจ็คที่จะจบครับ ต้องการด่วนมากเลย ช่วยทีครับ
จากคุณ : paper / modtanoy_poo@hotmail.com [2010-02-04 16:13:58]  

125.24.172.51 ความคิดเห็น #27776 (จาก IP: 125.24.172.51)
แค่ยกกำลังเป็นเลขลบเองครับ ลองกลับไปพยายามใหม่อีกรอบ
จากคุณ : sup98 [2010-02-08 00:00:32]

125.24.172.51 ความคิดเห็น #27777 (จาก IP: 125.24.172.51)
Binary Conversions

'The Functions in this module are designed to aid in working with BINARY
'numbers. Visual Basic does not include nor allow any representation of a
'number in binary format. Therefore, all of these functions work strictly on
'strings. All of the parameters passed into them and returned from them are
'strings.
'
' CONVERSION NEEDED FUNCTION
' ------------------------------------------------------
' Binary to Hex BinToHex(BinNum As String)
' Binary to Octal BinToOct(BinNum As String)
' Binary to Decimal BinToDec(BinNum As String)
' Hex to Binary HexToBin(HexNum As String)
' Octal to Binary OctToBin(OctNum As String)
' Decimal to Binary DecToBin(DecNum As String)
'
'
Option Explicit

Function BinToHex(BinNum As String) As String
Dim BinLen As Integer, i As Integer
Dim HexNum As Variant

On Error GoTo ErrorHandler

BinLen = Len(BinNum)
For i = BinLen To 1 Step -1
' Check the string for invalid characters
If Asc(Mid(BinNum, i, 1)) < 48 Or _
Asc(Mid(BinNum, i, 1)) > 49 Then
HexNum = ""
Err.Raise 1002, "BinToHex", "Invalid Input"
End If
' Calculate HEX value of BinNum
If Mid(BinNum, i, 1) And 1 Then
HexNum = HexNum + 2 ^ Abs(i - BinLen)
End If
Next i
' Return HexNum as String
BinToHex = Hex(HexNum)
ErrorHandler:
End Function

Function BinToOct(BinNum As String) As String
Dim BinLen As Integer, i As Integer
Dim OctNum As Variant

On Error GoTo ErrorHandler

BinLen = Len(BinNum)
For i = BinLen To 1 Step -1
' Check the string for invalid characters
If Asc(Mid(BinNum, i, 1)) < 48 Or _
Asc(Mid(BinNum, i, 1)) > 49 Then
OctNum = ""
Err.Raise 1002, "BinToOct", "Invalid Input"
End If
' Calculate Octal value of BinNum
If Mid(BinNum, i, 1) And 1 Then
OctNum = OctNum + 2 ^ Abs(i - BinLen)
End If
Next i
' Return OctNum as String
BinToOct = Oct(OctNum)
ErrorHandler:
End Function

Public Function BinToDec(BinNum As String) As String
Dim i As Integer
Dim DecNum As Long

On Error GoTo ErrorHandler

' Loop thru BinString
For i = Len(BinNum) To 1 Step -1
' Check the string for invalid characters
If Asc(Mid(BinNum, i, 1)) < 48 Or _
Asc(Mid(BinNum, i, 1)) > 49 Then
DecNum = ""
Err.Raise 1002, "BinToDec", "Invalid Input"
End If
' If bit is 1 then raise 2^LoopCount and add it to DecNum
If Mid(BinNum, i, 1) And 1 Then
DecNum = DecNum + 2 ^ (Len(BinNum) - i)
End If
Next i
' Return DecNum as a String
BinToDec = DecNum
ErrorHandler:
End Function

Public Function OctToBin(OctNum As String) As String
Dim BinNum As String
Dim lOctNum As Long
Dim i As Integer

On Error GoTo ErrorHandler
' Check the string for invalid characters
For i = 1 To Len(OctNum)
If (Asc(Mid(OctNum, i, 1)) < 48 Or Asc(Mid(OctNum, i, 1)) > 55) Then
BinNum = ""
Err.Raise 1008, "OctToBin", "Invalid Input"
End If
Next i

i = 0
lOctNum = Val("&O" & OctNum)

Do
If lOctNum And 2 ^ i Then
BinNum = "1" & BinNum
Else
BinNum = "0" & BinNum
End If
i = i + 1
Loop Until 2 ^ i > lOctNum
' Return BinNum as a String
OctToBin = BinNum
ErrorHandler:
End Function

Public Function DecToBin(DecNum As String) As String
Dim BinNum As String
Dim lDecNum As Long
Dim i As Integer

On Error GoTo ErrorHandler

' Check the string for invalid characters
For i = 1 To Len(DecNum)
If Asc(Mid(DecNum, i, 1)) < 48 Or _
Asc(Mid(DecNum, i, 1)) > 57 Then
BinNum = ""
Err.Raise 1010, "DecToBin", "Invalid Input"
End If
Next i

i = 0
lDecNum = Val(DecNum)

Do
If lDecNum And 2 ^ i Then
BinNum = "1" & BinNum
Else
BinNum = "0" & BinNum
End If
i = i + 1
Loop Until 2 ^ i > lDecNum
' Return BinNum as a String
DecToBin = BinNum
ErrorHandler:
End Function

Public Function HexToBin(HexNum As String) As String
Dim BinNum As String
Dim lHexNum As Long
Dim i As Integer

On Error GoTo ErrorHandler

' Check the string for invalid characters
For i = 1 To Len(HexNum)
If ((Asc(Mid(HexNum, i, 1)) < 48) Or _
(Asc(Mid(HexNum, i, 1)) > 57 And _
Asc(UCase(Mid(HexNum, i, 1))) < 65) Or _
(Asc(UCase(Mid(HexNum, i, 1))) > 70)) Then
BinNum = ""
Err.Raise 1016, "HexToBin", "Invalid Input"
End If
Next i

i = 0
lHexNum = Val("&h" & HexNum)
Do
If lHexNum And 2 ^ i Then
BinNum = "1" & BinNum
Else
BinNum = "0" & BinNum
End If
i = i + 1
Loop Until 2 ^ i > lHexNum
' Return BinNum as a String
HexToBin = BinNum
ErrorHandler:
End Function
จากคุณ : sup98 [2010-02-08 08:22:34]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ webmaster@sourcecode.in.th
  • ห้ามใช้คำหยาบและคำพูดที่ไม่เหมาะสม
  • ขอสงวนสิทธิหากตรวจพบ ข้อความที่ไม่เหมาะสม ข้อความนั้นจะถูกลบทันที
ชื่อ
อีเมล์
รายละเอียด

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

 
 
คลิปสอนเขียนโปรแกรม
เรียนเขียนโปรแกรมดอทเน็ต
เรียนเขียนโปรแกรมแอนดรอยด์
เรียนเขียนโปรแกรมเบล็คเบอร์รี่
เรียนเขียนโปรแกรมซี ซีพลัสพลัส
เรียนเขียนโปรแกรมจาวา
เรียนการใช้งานลินุกส์
เรียนการเขียนโปรแกรมวินโดว์โฟน
เรียนการเขียนโปรแกรมพีเฮชพี มายเอสคิวเอล
อัตราค่าโฆษณา
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
แบบสำรวจ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

สงวนลิขสิทธิ์ ห้ามคัดลอก ทำซ้ำ แก้ไข ดัดแปลง ไม่ว่าในรูปแบบใด โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษร
เลขทะเบียนพาณิชย์อิเล็กทรอนิกส์จากกระทรวงพาณิชย์: 7100503002000
Copyright 2001 SourceCode.in.th