|
You're going to have to build a string to send. There's a bunch of ways to do it, but this works in a short example:
Dim passwordCommand As String = Chr(&H2) & "PSWD" & Chr(&H1) & "{0}" & Chr(&H3) & Chr(&H1F) & Chr(&H7F)
Dim setPasswordCommand As String = String.Format(passwordCommand, "MyPassword")
You then send the string contained in setPasswordCommand to the COM port you opened using the SerialPort class (.NET Framework 2.0 and above only).
|
|
|
|
|
Here is my code.
When I send a string SERIELL. The device is suppose to send back a confirmation string 'OK'. When I do a MessageBox.Show(serialPort.ReadChar) I get two message boxes one with 79 one with 75. These are UNICODE for 'O' and 'K'. GOOD
But when I send this for a password I am suppose to get ACK or 0x06 back and I only get a 21 back. Do I need to send in UNICODE? Binary? Hex? What are your thoughts? The original code was ANSI-C or C#.
Dim passwordCommand As String = Chr(&H2) & Chr(&H50) & Chr(&H53) & Chr(&H57) & Chr(&H44) & Chr(&H1) & Chr(&H50) & Chr(&H61) & Chr(&H73) & Chr(&H73) & Chr(&H77) & Chr(&H6F) & Chr(&H72) & Chr(&H74) & Chr(&H3) & Chr(&H1F) & Chr(&HF7)
|
|
|
|
|
No idea. I don't have the device to toy with, so it's impossible for me to test. It could be that's an error return. I have no way of knowing since I don't have the documentation and I don't have the device. For specific programming support on the device, the manufacturer of it is your best source of information.
|
|
|
|
|
I'm using VS2005, and have a problem using the datagrid. I'm building a form to create a member's details, including a member's list of jewels. I've combined all one to one member's details into one table, the member table, except the member_jewel table, because a member can have zero or more jewels. The jewel part is where I stuck. The member_jewel has 3 attribues only: memberID, jewelName and dateAward.
I want to use Datagrid or others to have a list of jewels a member has without showing(and inputting) the memberID on the datagrid. I mean I want two columns only on the datagrid: jewelName and dateAward; the memberID on each row of the datagrid could be hidden and be saved automatically. Anyone please help me. Thank You.
Ryan
|
|
|
|
|
Is there code to open a jpg if I were using the vb editor in MS access? I need to click a button, then open the JPG. I have tried looking for controls but all are shareware which unfortunately is out of the question for my project. Does anyone know how to do this? I just need the picture to display (even if it is in the 'crappy' Windows Picture and Fax Viewer or whatever its called) Thanks a bunch.
|
|
|
|
|
Just pull the picture from the database and dump it into a picture box control...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Sorry, I wasn't clear enough...the picture is just saved on the local machine, not in my database...I just need to open it using the filepath as a parameter. I'm going to use a button and its Click() event to automatically browse to this path and open it.
|
|
|
|
|
A simple example:
Private Sub Command1_Click()
Me.CommonDialog1.ShowOpen
If Me.CommonDialog1.FileName <> "" Then
Me.Picture1.Picture = LoadPicture(CommonDialog1.FileName)
End If
End Sub
However you get the path\filename of the jpg (or bitmap or GIF), just load it into a picture box with the LoadPicture function.
|
|
|
|
|
How do I use a PictureBox?
Right now I have
Dim picbox As PictureBox
'tried this and didn't work'
picbox = LoadPicture("C:\file.jpg")
'tried this and got "type mismatch"'
Set picbox = LoadPicture("C:\file.jpg")
|
|
|
|
|
I'm not very good at programing, and when i tries to save the bitmap to a file i get the "A generic error occurred in GDI+." what am i doing wrong? I wrote a smal app to demonstrate what my problem is. In the real app it modifies some exif data and are then supposed to save the file.
Public Class frmSaveFile
Private _bitmap As Bitmap
Private _filename As String = "d:\husvagn.jpg"
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
_bitmap = New Bitmap(_filename)
btnOpen.Enabled = False
btnClose.Enabled = True
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
_bitmap.Save(_filename)
btnClose.Enabled = False
btnOpen.Enabled = True
End Sub
End Class
|
|
|
|
|
It errors out because the original file is locked by the Bitmap object that you loaded the image into. You can get around it by loading the image using a FileStream instead. See this[^] MS KB article for a sample.
|
|
|
|
|
You saved my day, Thanks.. I learn something new everyday!
|
|
|
|
|
Using VB6, I created an XML file, but now I need to save it to a network location that has security on it. Is there a way to save it the the network location, specifying what the username and password?
Thanks.
|
|
|
|
|
The security is there for a reason. No, you can't get around that prompt. It's showing up because the server you're trying to save the file to doesn't know who you are, because it doesn't recognize the account you logged into on your machine, and will not trust you until you provide proof of your identity using credentials it does recognize.
|
|
|
|
|
If the user who is running the application does not have access to the network location, you can use the WNetAddConnection2 Win32 API function to map a drive to the location using credentials you specify, then save the file there then use WNetCancelConnection2 API function to remove the mapped drive.
Some example code[^]
|
|
|
|
|
I have to work through a massive project made using VB6.0 IDE. Unfortunately what I need to do is identify SQL statements in the code and this requires going through hundreds of classes (forms included). I heard there is the existance of a possible add-in which will colour the syntax of string values.
Example: "myVariable" or "SELECT * FROM tblName"
I need it to look like the VS.NET IDE in that way where string values are coloured differently from normal syntax.
By the way, I have spent an hour at work searching for it and just keep comming up with similar Add-ins. I just think it's best for the answer to come to me so I don't loose anymore time.
Thanks for reading and hope you can help!
Oh Hai
|
|
|
|
|
I haven't used VB6 in 6 years. I don't know of an addin that can do that in the old IDE.
|
|
|
|
|
Some people said there is something. Some way or option to get it. I mean if VS.NET IDE has I'm sure someone probably made an Add-In for VB6 IDE since it would be quite useful to a certain extent. Since VB6 is still an extremely popular language to develop business solutions at present.
Would be nice if anyone can share anything if they know anything at all about this please.
Oh Hai
|
|
|
|
|
Mikey484 wrote: Since VB6 is still an extremely popular language to develop business solutions at present.
Yeah, but support for it is all but dead.
Mikey484 wrote: I mean if VS.NET IDE has I'm sure someone probably made an Add-In for VB6 IDE
Oh I don't doubt that. The question becomes, is it still available??
|
|
|
|
|
Dave Kreskowiak wrote: Oh I don't doubt that. The question becomes, is it still available??
Very good point, it's hard to know with all the other Add-ins that appear when I attempt to look around. Well I guess I'll continue asking around, and searching. Definitley will need it for tommorrow because otherwise, I'll have to continue going through the code slowly and loosing lots of time.
Oh Hai
|
|
|
|
|
I'm writing a device application. For the debugging I'm using the emulator Visual Studio provides. The problem is that I cannot get the emulator to connect to our network in order to query a database table. The computer I'm developing this on is connected to the network through a network cable but how can I get the emulator use this connection to query a table?
|
|
|
|
|
This depends on which version of the enumator you're using, but you can click on the Device Options button just to the right of the dropdown that lets you select the device/emulator to use. You'll get a dialog that let's you pick the device/emulator and configure it's options. Click the emulator you're using, then click Properties. You get another dialog with a Network tab that lets you enable the emulators network support and pick the real network adapter to bind it to.
|
|
|
|
|
hi
i have a problem with saving a control along with its properties and retrieving it back..
1. i'm using property grid control to set the properties for a control that is stored in or for a newly added control in run time.
2. after setting the properties for that control i've to save that control and to retieve that control for alteration
kindly help me to solve this
|
|
|
|
|
There's a reason why the Control class, which all controls derive from, is not attributed Serializable. Not all properties of a control can be serialized easily.
You'd have to write your own code to serialize the controls in your collection. You'd probably limit your serializer to only those properties you are interested, like Location, Size, Text, ..., for each type of control, and look at only those properties for that type of control.
You can get a feel for a deserializer by looking at a blog post by Beth Massi[^] on the subject of Dynamic Programming.
|
|
|
|
|
Is it possible to catch / initiate commands if a crystal report is displayed?
eg. application build on VB6 / .net, called abc report & now user may select any item on report & get further reports or actions back in VB
(NASIR MAHMOOD)
Iye Soft,
www.iyesoft.com.pk
|
|
|
|