|
hi all..
i have a problem in communication software to hardware.. actually, i want to know the basic concept how we send the data to the hardware using serial port.. for example, how can i switch on and off the led when i click the button in my vb projects..
can someone please help me..
areon25
|
|
|
|
|
Then you must know how the hardware reads the data. Meaning you must know the communication protocol. What type of hardware is it?
BR
Fredrik
|
|
|
|
|
thanks for the email..
actually, i just want to switch ON/OFF the LED as i mention before..
areon25
|
|
|
|
|
And that't when it gets messy!
In order to swith on/off the led on the hardware you must send the correct data on your serial port.
I have written some protocols before for serial comunication and they all start with a command sequence. In your case I would have had a command LED_CONTROL which would have been the character "L" and then which state to put the led in "0" or "1".
By sending "L" on the serial port the hardware knows that next character recieved will contain "0" or "1" and when I send "0" the hardware swithces the led off.
Two weeks ago I wrote a program to print stickers with a Intermec PC4 printer.
http://www.intermec.com/eprise/main/GSS/Service/Content/Manuals/Show_ManualSearchResults?Product=PRTRPC4&Language=English[^]
Take look at the Programmer's Reference Manual.
That's why you must know the protocol for the hardware communication.
BR
Fredrik
|
|
|
|
|
i have problem with sending email in windows application, can anyone give me example?
................
|
|
|
|
|
It would be much better if you explained what the problem was.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: It would be much better if you explained what the problem was.
agreed.
|
|
|
|
|
Dim objEmail As New MailMessage()
..
..
I don't know how to do next
................
|
|
|
|
|
Look at MSDN, they have numerous examples about EMail...
|
|
|
|
|
I'm assuming you're using VB.NET 2005... MailMessage[^] docs, complete with an example of how to use it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I have this sub:
Sub ConDB()
Dim oSqlCliCon As SqlConnection
oSqlCliCon = New SqlConnection("Data Source=120.260.9.8;Integrated Security=SSPI;Initial Catalog=pubs")
Try
oSqlCliCon.Open()
Catch ex As Exception
msgbox(ex.Message)
End Try
oSqlCliCon.Close()
End Sub
The problem:
The code works for VB6/VBNET/VBNET2003 for SQL SERVER
for VBNET2005 works only local but for the SQL SERVER don't.
The exception message:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The exception message if modify the connectionstring:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Please help, thank you.
gangeles
|
|
|
|
|
Your question doesn't make much sense. Are you trying to connect to a SQL Server 2005 database?? If so, you have to go into the SQL Server configuration manager and turn on TCP/IP connections. By default, an SQL Server 2005 installation will only accept connections from applications running on the machine the server is installed on.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave thank you for your response,
We work with VB6, VB.NET, VB.NET.2003 and the last VB.NET.2005
We try to walk with the technology.
When work with VB6, VB.NET, VB.NET.2003 don't have problem, what I can say, we don't to change nothing because works fine.
But, since install VB.NET.2005 and try to do an application don't can stablish a conexion to the server.
So, we don't need to change the configuration but meaby vb.net.2005 requieres to change, and we don't have the config to change, I look on sql-server-tool and have de TCP/IP added (enabled), you refer to this?
The NET
Principal Server (have the DB)
Have a Domain
We attach to the domain
I test on two ways from client to server and server to client to stablish conexion but don't stablish.
Hope that you can help us
gangeles
|
|
|
|
|
There's nothing to change!
You might want to look into making sure that you have the latest MDAC[^] installed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave
Than you again for your response.
Exactly, we now test with the 3 forms to connect:
1. Standard Security
2. Trusted Connection
3. Connect via an IP address
(referer : http://www.connectionstrings.com/)
So, we have 3 more servers and try to connect to them, but only one server failed to connect.
I think like you is a configuration (meaby SQL server) or software to install problem, but We don't know what it´s.
We can follow like first step the MDAC
gangeles
|
|
|
|
|
I'm a new programmer. I would like to know the code for a cascading menu like you see in windows. Thanks.
Dodz
|
|
|
|
|
Hey, everybody.
I have a panel within a user control that I need to add link labels to. During runtime, the user selects an item from a combo box and based on which item is selected a list of filenames is returned from a database which are then respectively and dynamically made into link labels and added to the panel.
My problem is that I'm new to VB as a whole and I'm ignorant as to how one can add events to dynamically-created controls. In this instance, I would need to know when one of the link labels is clicked and which one was clicked.
Below is the code I have currently which works correctly to populate the panel with the link labels. Any help would be greatly appreciated. Thank you!
If (strSourcePath.Contains(",")) Then
strFilePaths = strSourcePath.Split(",")
nNumFiles = strFilePaths.Length
ReDim xLinkList(nNumFiles)
Dim nCount As Integer
For nCount = 0 To nNumFiles - 1
strFileNames = strFilePaths(nCount).Split("\")
xLinkList(nCount) = New LinkLabel()
xLinkList(nCount).Name = "lnkLabel" & nCount
xLinkList(nCount).Text = strFileNames(4)
Next
Else
nNumFiles = 1
If (System.IO.File.Exists(strSourcePath)) Then
strFileNames = strSourcePath.Split("\")
xLinkList(0) = New LinkLabel
xLinkList(0).Name = "lnkLabel"
xLinkList(0).Text = strFileNames(4)
End If
End If
panFiles.Controls.AddRange(xLinkList)
Dim i As Integer
For i = 0 To nNumFiles - 1
panFiles.Controls.Item(i).Dock = DockStyle.Top
Next
-- modified at 17:40 Tuesday 11th July, 2006
|
|
|
|
|
Take a look at the AddHandler method.
Something like this..... (code from memory so usual warranty applies )
If (strSourcePath.Contains(",")) Then
strFilePaths = strSourcePath.Split(",")
nNumFiles = strFilePaths.Length
ReDim xLinkList(nNumFiles)
Dim nCount As Integer
For nCount = 0 To nNumFiles - 1
strFileNames = strFilePaths(nCount).Split("\")
xLinkList(nCount) = New LinkLabel()
xLinkList(nCount).Name = "lnkLabel" & nCount
xLinkList(nCount).Text = strFileNames(4)
AddHandler xlinkList(nCount).Click AddressOf ClickHandler
Next
Else
nNumFiles = 1
If (System.IO.File.Exists(strSourcePath)) Then
strFileNames = strSourcePath.Split("\")
xLinkList(0) = New LinkLabel
xLinkList(0).Name = "lnkLabel"
xLinkList(0).Text = strFileNames(4)
AddHandler xlinkList(0).Click AddressOf ClickHandler
End If
End If
panFiles.Controls.AddRange(xLinkList)
Dim i As Integer
For i = 0 To nNumFiles - 1
panFiles.Controls.Item(i).Dock = DockStyle.Top
Next
Private Sub ClickHandler(sender As Object, e As EventArgs)
MessageBox.Show(DirectCast(sender, LinkButton).Name)
End Sub
My Blog[^] FFRF[^]
-- modified at 17:55 Tuesday 11th July, 2006
|
|
|
|
|
Awesome and thank you!
AddHandler xlinkList(0).Click, AddressOf ClickHandler worked like a charm. Additionally, I didn't know about the DirectCast method in VB so I was able to use that for other purposes as well to simplify my work. For those interested, the following is how I wrote my event handler for the dynamically-created link labels:
Private Sub LinkClick(ByVal Sender As Object, ByVal e As EventArgs)
nCurrFileNum = DirectCast(Sender, LinkLabel).Name
strCurrFile = DirectCast(Sender, LinkLabel).Text
Dim webURL As New Uri(strDefaultPath + strCurrFile)
webMain.Url = webURL
End Sub
Where:
nCurrFileNum is the current file number we are currently working with
strCurrFile is the current filename (and just the filename - not the path)
strDefaultPath is the default (read from the database) path to the files
webMain is the webcontrol used within the user control to show the .pdf files
Thank you for the help!
-- modified at 9:42 Wednesday 12th July, 2006
|
|
|
|
|
No problem...
One word though... dependign on how modular you want to make your code you may want to check to make sure that you can actualy do the cast before you do it. That way if for some reason you happen to accidently patch that event hander to a different control you will catch that and not throw an excpetion. Maybe wrap the cast in a try/catch block or something.
You can do something like:
Private Sub ClickHandler(ByVal sender As Object, ByVal e as EventArgs)
If (sender.GetType.ToString = "LinkLabel") then
nCurrFileNum = DirectCast(Sender, LinkLabel).Name
strCurrFile = DirectCast(Sender, LinkLabel).Text
Dim webURL As New Uri(strDefaultPath + strCurrFile)
webMain.Url = webURL
Else
'Not a linklabel control.
End If
End Sub
My Blog[^] FFRF[^]
|
|
|
|
|
have a windows application that accesses a oracle database. I need to
deploy it on an intranet. It is an application that will be access by several
end users. I would like to deploy it in one common place and let end users
execute the same exe thus making it easy it implement changes as they will be
needed. How do you deploy a winform application in this manner?
i've already build msi file and i am deploying on my server but it gives me error that shows unhandled exception.
and also it is running fine on couple of computer ..that i installed on them independently. it is running fine.
Hemaxi
-- modified at 17:20 Tuesday 11th July, 2006
|
|
|
|
|
you should look into clickonce deployment. Basically all you need to do is right click on your project and click on publish.
There is a lot of info from Microsoft on this.
http://msdn2.microsoft.com/en-us/library/t71a733d.aspx
|
|
|
|
|
Hey Gavin
Thanks for ur suggetion.
i've added setup project in my solution. then also i've to do clickonce deployment?
Thanks
hemaxi
|
|
|
|
|
Any machine that the application runs on is going to have to have the Oracle 8i Client installed on them at a minimum. The Oracle provider in .NET can't work without it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hey Dave,
Thanks man.
yeah..every machine have oracle 9i installed . my question is The Oracle Provider for .NET is not installed on every machine. should i install on every machine or if only on server will be fine.
b/c several ppl is going to use this application.its tedious job to install on every client machine . pls. reply me as soon as possible.
i am stuck here with the deployment .
if you have any idea how to deploy my application on server then let me know.
actually what i did is..i ve added setup project in my solution. and built it. and create .msi file.
when i am installing on the other machine and if it has ODP (oracle provider for net) installed on that its running perfectly. but it doesnt have that then its gives me error: "TNS couldnt resolve the service name"
and i am using System.Data.OracleClient and have referenced to my solution.
i m not using DataAccess.dll
i've not referenced to this dll.
i dont have any idea.
If u can reply me.that will be great.
Thanks a lot..
Hemaxi
|
|
|
|