|
An int16 (or 'short') is a two-byte value. Intel processors are "little-endian", meaning the last byte (least significant) is stored first and the first byte (most significant) is stored last.
In your example, your two byte value, (12) 0x000C, is stored in memory like this: 0x0C, 0x00. So that's why you're getting the bytes in the order you are. BitConverter is returning the bytes in the order they appear in memory.
If you were running the exact same code on a processor that is big-endian, the bytes would show up in the array in the order opposite of what you're seeing now.
Now, having said all that, if you're looking for just getting a string for the hexadecimal representation of your value, all you have to do is this:
Dim myInt As Int16 = 12
result = String.Format("X", myInt)
If you're dealing with values that will never be greater than 255, why are you using an Int16? Why not just use Byte instead?
|
|
|
|
|
How to solve error 50003 in vb6 in win 10
|
|
|
|
|
Have you tried entering 'vb6 error 50003' in a browser search engine?
|
|
|
|
|
By fixing the secret error in your secret code, obviously.
Seriously, if you want someone to help you fix an error in your code, you need to provide the relevant parts of your code, and the full details of the error.
If you don't have the code, then contact the person who wrote it to get the problem fixed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
im making insert update and delete with database for my activity and the teacher give task to add print and im trying to make on my own but its diffucult for me i hope you can help me out with these.
im beginner at visual basic.
im using printdocument and printpreviewdialog
Here my code
Print button
Private Sub btnprint_Click(sender As Object, e As EventArgs) Handles btnprint.Click
Dim PrintPreview As New PrintPreviewDialog
PrintPreview.Document = PrintDocument1
PrintPreview.ShowDialog()
End Sub
Print Document Print Page
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim H As Integer = 0
H = 50
e.Graphics.DrawString("PRINT", New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H)
For Each Itm As ListViewItem In ListView1.Items
e.Graphics.DrawString(Itm.Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H)
e.Graphics.DrawString(Itm.SubItems(0).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(1).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(2).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(3).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(4).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(5).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(6).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(7).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(8).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
e.Graphics.DrawString(Itm.SubItems(9).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H)
H += 20
Next
End Sub
here's my ouput
Output
|
|
|
|
|
You are drawing every sub-item starting at the same horizontal coordinate. Unsurprisingly, this results in the text of every sub-item overlapping.
You need to increase the horizontal coordinate for each sub-item. You can either use the MeasureString method[^] to measure how much space your string will take up, or used fixed coordinates and use the DrawString overload[^] which limits the size of the output to prevent the text from overlapping.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You are drawing all 10 subitems at the same location on the page. You need to change the X location for each item. The code could be simplified by creating a loop and using a single Font element:
Dim TnrFont as Drawing.Font = New Drawing.Font("Times New Roman", 10)
e.Graphics.DrawString("PRINT", TnrFont, Brushes.Black, 50, H)
For Each Itm As ListViewItem In ListView1.Items
e.Graphics.DrawString(Itm.Text, TnrFont, Brushes.Black, 50, H)
Dim Left as Integer = 150
For subindex as Integer = 0 To 9
e.Graphics.DrawString(Itm.SubItems(subindex).Text, TnrFont, Brushes.Black, Left, H)
Left += 100
Next
H += 20
Next
|
|
|
|
|
Pls can visual basic 2010 do face identification and recognition. if yes how can i design it, am new in visual basic...Thanks.
|
|
|
|
|
You need to research what libraries are available that provide such a feature. And to be honest, this is quite an advanced subject for someone who, as you say, is new to VB.
|
|
|
|
|
Heavy stuff for someone new to VB!
It's not a case of can VB "do face identification" but "can I write code in VB.net that calls a library that does facial identification"
This article discusses some of the models that are available Introduction to Face Identification[^] N.B. The code is in python, I'm only including the article for the links to the models and the general discussion.
This article specifically discusses the EMgu tool - again it uses C# rather than VB but the principles are all there Image Recognition with C# and Emgu Libraries[^]
Most of the tools from the links in the articles will have resources to show you how to use them e.g. Code Gallery - Emgu CV: OpenCV in .NET (C#, VB, C++ and more)[^]
|
|
|
|
|
HOW TO CODE A REFRESH BUTTON IN VB.NET FORM PLEASE GUIDE
|
|
|
|
|
Depends on what you want to refresh. No one knows what you are talking about.
|
|
|
|
|
...and STOP YELLING at people. Typing everything in all caps is the equivalent to screaming at people on the internet.
|
|
|
|
|
in the onclick event of the button you write the code to refresh the magic thing you need refreshing.
I hope like hell you are not the accounting firm in London asking such a badly formed question.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Maybe it's the manager who decided to fire their only programmer because he read on a magazine that VB.NET is so easy anyone can write code in it?
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Mycroft Holmes wrote: I hope like hell you are not the accounting firm in London asking such a badly formed question. Wait for your coming colonscopy, and see the device running W98. Imagine a dependency on vbrun300.dll.
Have fun
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello;
I have image on PictureBox, Cinverted to Base64String string and saved in Database as following:
Dim ms As MemoryStream = New MemoryStream
Dim bmp As Bitmap = New Bitmap(PictureBox1.Image)
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.jpg)
Dim My_Photo_Str As String = Convert.ToBase64String(ms.ToArray)
myqry = "update MYTABLE set COLUMN1=" & "'" & My_Photo_Str & "'" & "where COLUMN2=" & 50
mycmd = New OleDbCommand(myqry, conn)
mycmd.CommandTimeout = 0
mydr = mycmd.ExecuteReader
Now that image need to retrieve it or shows on PictureBox, So I used the following:-
myqry = "select * from MYTABLE where COLUMN2=" & 50
mycmd = New OleDbCommand(myqry, conn)
mycmd.CommandTimeout = 0
mydr = mycmd.ExecuteReader
mydr.Read()
Dim PIC As Byte()
PIC = mydr("COLUMN1")
Dim My_Photo = New MemoryStream(PIC)
PictureBox1.Image = Bitmap.FromStream(My_Photo) <<<<<-----HERE GOT ERROR
the error on last line while try to set image to PictureBox, and error said that cannot convert Byte() to image, If any help will so appreciated
thanks
|
|
|
|
|
|
Why are you converting the image to a Base64 string? You don't have to do that to save it it in the database.
Databases support blobs (Binary Large Objects) natively, so conversion to Base64 is not necessary.
You can't directly use the Base64 string to create a Bitmap object from it. You have to convert the Base64 string back into an array of bytes, then create the Bitmap from that array.
|
|
|
|
|
|
ffmpeg.exe will not save file names with a number since the first "output.avi" and exists but a new one that has "output(1).avi" will not be accepted. What can I do here.
|
|
|
|
|
I figured out how to do it :-) :-D
|
|
|
|
|
Hello,
I am making a VB.NET forms application and need to connect with SQL Server over the internet using the following connection string:
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
From what I could glean from the internet, apparently this kind of connection string is vulnerable to being hacked. Thus what should I do to encrypt this string and also enable decryption only at the remote server.
Whenever I search the internet, I only come across ways to encrypt web.config and app.config. This apparent security flaw does not seem to be covered anywhere.
Thanks in advance,
Khalid.
|
|
|
|
|
An SQL server should never be directly exposed to the internet. You normally expose the database functionality through a securable web service and your application talks to the web service to handle all the database work.
|
|
|
|
|
Dave Kreskowiak wrote: n SQL server should never be directly exposed to the internet. You normally expose the database functionality through a securable web service and your application talks to the web service to handle all the database work.
Ok, can you point me to a webpage or post regarding how to go about this?
I am sorry if my questions appear rather naive but this is the first time I am going about this whole thing.
Khalid.
|
|
|
|
|