|
Hey Dave, thanks for the quick response!
We are using PIC32 Series, digi key part number DM320003-2-ND if your curious. I'm pretty new to the visual studios world and trying to figure it out has proven to be tough. Do you know of any online tutorials that are related to this subject. If you know of any code lessons that teach you how to access the USB ports that would be great. There are so many tools with visual studios and it seems that good tutorials are hard to come by.
Thanks again
josh
|
|
|
|
|
You don't access the USB "ports". Look at what USB stands for: Unviersal Serial BUS. It's not treated like a port, but an expansion bus, like the expansion slots inside the computer. You need to know how the device treats USB. Most devices like this will expose themselves on the bus as a serial port (COM1, COM2, ...). You would just use normal serial port methods to talk to it, not any USB methods.
|
|
|
|
|
Here is an article on CP that is all about communicating with an Arduino micro over serial port using VB.
Principles should be the same for a PIC32.
Arduino with Visual Basic[^]
|
|
|
|
|
my buttons are not dynamics. i got 10 buttons, his name is a number like 100, 101 is for an hotel , but i dont want to make a sub for each button.
sorry if i don't explain me good but i dont speak english
|
|
|
|
|
Hi,
if you connect several Controls to a single handler, you can use the first parameter ("object sender") to identify the source of the event. For buttons, cast the sender to a Button, and you have it. That is exactly why it is there.
|
|
|
|
|
this is what i did
Sub SetHabs(ByVal sender As Object, ByVal e As EventArgs)
Dim boton As New Button
boton = CType(sender, Button)
Dim btnName As String = boton.Name
end sub
with this in each click event i get the name
|
|
|
|
|
Then do a Select Case on the boton.Name and handle what each button should do..
|
|
|
|
|
if the buttons are supposed to do all kinds of different things, then it does not make sense to give them all the same Click handler to begin with...
|
|
|
|
|
thanks, all the buttons represents rooms, in this case all buttons check one fuction , that is the availability for each room so i start to get a name who is a integer to make different things of the same function.
|
|
|
|
|
if you need details about rooms, I trust you either have a Room class that holds that information, or the room number serves as a primary key to a rooms table in a database.
FYI: most WinForms Controls also have a Tag property where you can store one item of information (possibly a reference to a Room instance).
|
|
|
|
|
yes, my I have a room Class and my room number is the primary key in my DB, i have a little trouble becose i only make webs with , php,Ajax,Javascript ETC but this project needed to be a desktop application.
Thank you so much for the help, this is a very cool site and and responses are very fast different from sites in Spanish.
|
|
|
|
|
yes , i think in this case, i have 3 floors in this hotel, so each button name is like f1_100, f1_101 ,only make 3 case with a string search ,then , with this search get the total room name ho is the primary key from my DB.
|
|
|
|
|
Hi,
0.
I can't find a question in there.
1.
please use PRE tags to show code (i.e. <PRE>some code</PRE>) for better readability
2.
no need for New Button, you do not intend to create yet another button!
Dim boton As Button = CType(sender, Button)
3.
You now have the Button, you can do anything you like with it, such as:
someTextBox.Text = boton.Name & " was pressed"
|
|
|
|
|
First off, please forgive me if this is in the wrong section. I'm not sure if the probelm is my VB.Net code or my understanding of installers.
I've written a Windows Forms Application which stores it's preference settings in an XML file. I'm having problems with the file not being written to the directory I intend.
I want to write the XML file in the application folder C:\Program Files\MyApplication , but when I install and then run my application it writes the XML file in C:\Users\MyAccount\AppData\Local\VirtualStore\Program Files\MyApplication (This folder does not contain a copy of the executable, and is empty apart from the files written by my application when it runs).
I've made the following declarations in the application for the file name and path:
Private strApplicationPath As String = Application.StartupPath
Private strPreferencesFileName As String = "\Preferences.ini"
I have my application preferences stored in a DataSet called dsPreferences , and use the following code to write the file:
dsPreferences.WriteXml(strApplicationPath & strPreferencesFileName, XmlWriteMode.WriteSchema)
To help me sort out what's going on I've also added a lable to the form called lblPath to display the file name and path:
lblPath.Text = strApplicationPath & strPreferencesFileName
When I do a Release Build, and run the executable everything seems to work fine. The XML file is written in the same directory as the executable ie
C:\Projects\MyApplication\bin\Release
and lblPath.Text also displays
C:\Projects\MyApplication\bin\Release
HOWEVER!
I then use "Inno Setup 5" and "ISTool" to create an installer, and then install the application to
C:\Program Files\MyApplication .
Now when I run the application the XML file is written to
C:\Users\MyAccount\AppData\Local\VirtualStore\Program Files\MyApplication
instead of
C:\Program Files\MyApplication
where the executable is, even though lblPath.Text still shows that
strApplicationPath & strPreferencesFileName = C:\Program Files\MyApplication
!?!
The same issue is happening with the SqlCe database file for the application.
- What is this VirtualStore?
- Why is the XML file written there when I've been reasonably explicit that it should be stored in the same folder as the executable?
- How can I make sure the file gets written to the correct folder?
Thanking you in advance.
Paul
|
|
|
|
|
|
I think you hit the nail on the head there!
Thanks!
|
|
|
|
|
Hi all,
I have a strange problem:
Dim X As Single = 50
Dim Y As Single = 1000
Dim Z As Single = X \ Y
Why Z return me 0.0 as result of operation instead that 0.05?
If X is 100, then the result is correct (0.1).
I also tried to dimensione variables as Double, and to use Double.Parse instruction, but without resolve the problem.
All this is in a VB .Net Compact Framework routine.
Surely the problem is a "false" problem, but now I have a momentary "mind vacuum".....
Thanks for help.
modified on Sunday, January 17, 2010 12:32 PM
|
|
|
|
|
Single is a single precision float (from MSDN). I think this should explain. You can use decimal and I think it would give correct result.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi D@nish,
Single is a single precision float, but normally it returns decimal numbers.
I tryed to use Decimal type (return 0D value), but the problem is not resolved yet.
Here seems that the result is strangely cutted after the first decimal number.....
|
|
|
|
|
You're using the wrong slash. The Forward Slash, /, will give the correct result. The Backslash, \, does integer division.
|
|
|
|
|
Thanks Dave,
Without your help I risked to spend one week to try to resolve a false problem, and with no warranty to solve it in one week!
|
|
|
|
|
GENIUS
I couldn't work out why it wasn't happening!
Although you could have been a bit of a smartarse over that, it was nice to see you just pointed out what others failed to see!
------------------------------------
No Good Deed Goes Unpunished Clare Boothe Luce
|
|
|
|
|
Hi All,
I am looking for source codes/ .dll files which I can use in my project to create stylish buttons/Forms/Controls. Can someone suggest something on this?
Regards
R.S.
|
|
|
|
|
|
This is the first time, Iam trying to print the crystal report other than crystal report viewer..
Is it possible...?
Any Sample Codes?
Thanks
|
|
|
|