Detect A Serial Or LAN Connection?
Feb 22, 2009
I have a Windows forms control in VB.NET. I want to detect if the computer the user runs my program on has a serial and/or LAN port connected to the computer. native windows API for detecting Serial and LAN connection? S
View 2 Replies
ADVERTISEMENT
Jan 28, 2012
We have a weigh bridge connected to PC via serial port.A VB code fetches the data from serial port and puts it in clipboard,which can be used by other applications like SAP.
We have several different makes of weigh bridge at different locations, each with separate settings(baud rate,data bit,parity), hence we need to change the VB code each time a new make weigh bridge is installed.
can we write a generic VB code which can automatically detect all these settings and capture the weight?
View 14 Replies
Feb 16, 2011
Trying to make a serial connection from a windows app in vb.net to a com port through pc.also, can i make a separate listener windows app in vb.net that has its own virtual com port (for testing).the function of this connection is to simply pass variable states through the serial port on the pc to a microcontroller, which will interperate the code and perform actions based on the variable states.is there an easy way to implement serial port data communication in vb.net?
View 2 Replies
Jun 8, 2011
I have a problem when trying to detect the computers network connection status.
Here is the code I have used:
Dim IsAvalible As String = My.Computer.Network.IsAvailable
If IsAvalible = True Then Label1.Text = "Connected" Else <code>
<code>If IsAvalible = False Then</code> I <code>
Label1.Text = "Disconnected"</code></code>
End If [/ICODE] End If[/ICODE]
But for some even when the network is disconnected or the computers wifi is turned on I still get the result of "Connected". I think there something wrong with the code.
View 2 Replies
Mar 28, 2010
I have some Crystal Reports connecting to a Sql Server db that I would like to detect whether the connection is trusted or whether I need to supply the log on info (reports are not supplied by me so I can't control the connect method). If I just blindly supply login credentials, it won't connect if it is a trusted connection.The following does not work:
oRpt = oCR.OpenReport("C:MyReport.rpt")
if oRpt.Database.Tables(1).ConnectionProperties.Item("Integrated Security") = True then
'trusted connection[code]....
It gives the following error:Operator '=' is not defined for type 'IConnectionProperty' and type 'Boolean'.
I cannot find how create a construct in vb.net for IConnectionProperty. I can't find any documents from Crystal that explain it.I am using Crystal Reports XI - Developer
View 1 Replies
Oct 1, 2010
Ok I have a question about connection string in vb.net. Im using the string [Code] but here I am specifying the serverName by its name, now if I deploy my application and send it to another person to use it I see that server name is changing according to the name of the computer. Is there any way where by I can make my application to detect itself the Name of the server present in that computer and use it in connection string?
View 2 Replies
May 16, 2009
I made my program and now I just need to add in the serial and trial part of the application. I know the application must connect to the host and go to a txtfile. How would i do the trial and serial. Also If the serial is already activated I want the application to reject that Serial and Count how many times they entered in a wrong serial.
View 2 Replies
Mar 28, 2006
I have a stand alone VB.Net 2005 application that uses a serial port that generally stays open while the application runs on a Windows XP system. In trying to bullet-proof the UI, I ran into a problem when the USB to Serial Converter normally used to provide the serial port is disconnected while the serial port is open. In trying to handle the resulting error when accessing the port, I find I cannot close the port.
When trying to do so, the error message says something like "unable to close the port. You may not have sufficient permissions." Reconnecting the USB/Serial Converter does not reactivate the port.
[Code]...
View 8 Replies
Nov 21, 2011
With this code i check the serial serialnumber of a usb stick.
[code]...
It is not perfect because the programma crash when there is no usb in de PC.But how do i search fot the sctick if it has a name , for example PPH ? And not G: , because it is everytime a different station.
View 5 Replies
Aug 13, 2010
i just want to make a program with first form to enter the serial if correct just continue to form2 if incorrect just a popup say like "Serial Incorrect" how i can make it ?
View 2 Replies
Dec 13, 2009
I'm trying to pass a data packet from the serial data received event.The code can capture the data without any issues.I'm spinning my wheels on getting the data packet out of the thread for further processing.[code]
View 4 Replies
Aug 16, 2011
i am a absolute beginner and i want to use vb to receive data from micro controller through serial port using rs232 standards, i found this code to receive the data serially, can any one tell me where should i paste this code, so that the data received will be displayed in message box.Private Sub DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) HandlesSerialPort1.DataReceived
[Code]...
View 9 Replies
Oct 26, 2011
The link below has code to connect to a modem thru the serial port but it is for an earlier version of VB. when I convert the code, it does not fully convert and has 4 errors that prevent building the project. can someone tell me what needs to be changed or added?
[URL]
Note: the error: not CLS-Compliant
View 8 Replies
Aug 25, 2009
How do I assign a My.Settings.Item connection string to cmd.Connection connection string value?
Dim cmd As New SqlCommand()
cmd.Connection = My.Settings.Item("csStaffHoursWorked")
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spSaveDeltekImport"
View 3 Replies
Feb 5, 2010
Is there a way to display the connection properties dialog for connection string browsing(for database) in run time?
As I want the user to be able to connect to various database using the GUI.
View 6 Replies
Aug 3, 2011
i have an application. which is executed after every 5 mins. i have an open connection but it gives me the following error:
ExecuteScalar requires an open and available Connection. The connection's current state is closed.
my code is something like this. I have shown where all i am using ExceuteScalar()
Sub Main()
Try
connection.open()
cmd.ExecuteScalar()
[code]....
View 2 Replies
Aug 19, 2010
After running the following sub (VS debugger), I try to detach the database in SSMS, but it shows the connection open still and won't let me detach. If I close program in debugger, the database shows no connections. I check the dataadapter's connection in the finally block and is shows closed. What gives
Private Function ClientMasterDBFiles(ByVal MasterClientDBConnection As String, ByVal DBName As String) As DataTable
[Code]...
View 1 Replies
Mar 15, 2009
I have a simple scraper. It works on some websites, but on some there is this Error:
Quote:
IOException was unhandled Unable to read data from the transport connection: The connection was closed
It is occuring at "Dim htmlresults As String = Urlcontents.ReadToEnd()".
'Create the HttpWebRequest object
Dim req As HttpWebRequest = WebRequest.Create(URL)
'Set the timeout to 1 second (or 1,000 milliseconds)
req.Timeout = 10000
[code]....
View 2 Replies
Jun 21, 2010
I am attempting to write a program that will disable the Local Area Connection while leaving the Wireless connection enabled. My company is using net-books in our stores to demo air-cards and we need to keep them off of the LAN. I'm new to VB and VB.net, and it's been a while since I did any type of programming. I've gathered some code that others have posted in forums and tutorials and I'm working through a tutorial book, but I finally believe that I am stuck.
[Code]...
View 4 Replies
Nov 30, 2008
i make a class and when i call on form then that error occurs "ExecuteNonQuery requires an open and available connection, the connection Current stat is close "
Class Code isImports System.Data.SqlClientImports System.DataImports System.StringPublic Class DatabaseKits Dim Cn As New SqlClient.SqlConnection Public Function BuildConnection() As Boolean Try Cn.ConnectionString = "Persist Security Info=False;Integrated Security=True;Trusted_Connection=Yes;database=BizAimsPro2008;server=Server-2k3s" BuildConnection =
[code]....
View 3 Replies
May 17, 2012
I am connecting to a data stream that pushes data continuously and when I tried to set up a network stream I just could not connect and kept getting the 'not found' error. I used the httpwebrequest with webrequest.keepalive = true and started to consume the data by reading into a buffer and then appending to a stringbuilder. Once the stringbuilder reaches max size I flush it to a text file. The problem is that I get disconnected from the data stream because I am not reading the data fast enough. I need to keep the connection open and read the data while ensuring data gets stored in text files. If I use method "CONNECT" it does not connect to the stream.
While (True)
webrequest = DirectCast(Net.WebRequest.Create(url), HttpWebRequest)
webrequest.Credentials = New System.Net.NetworkCredential(username, password)
webrequest.Method = "GET"
[code]....
should I increase the buffer size and if so what is the max? that would mean I can read more data at a time and keep up with incoming push. Disparate here.
ACtually also I noticed that it gets stuck on this line
numbytesread = responseStream.Read(bufferread, 0, BUFFER_SIZE)
and then eventually I get disconnected.
View 1 Replies
May 17, 2012
I am connecting to a data stream that pushes data continuously and when I tried to set up a network stream I just could not connect and kept getting the 'not found' error. I used the httpwebrequest with webrequest.keepalive = true and started to consume the data by reading into a buffer and then appending to a stringbuilder. Once the stringbuilder reaches max size I flush it to a text file. The problem is that I get disconnected from the data stream because I am not reading the data fast enough. I need to keep the connection open and read the data while ensuring data gets stored in text files.If I use method "CONNECT" it does not connect to the stream.[code]
View 1 Replies
Sep 3, 2011
I understand the possibilities for encrypting a connection string in .net v4. I have a win forms application that will be used by multiple people on different machines. I understand that I need to protect the connection string at time of the app being first run on the target machine. However I am concerned that for a period of time my connection string will be unencrypted. I am looking for advice in how to deploy my app with the connection string already encrypted or encrypted during installation. encrypting the connection string in a secure way?
View 1 Replies
Dec 19, 2011
Try If functionmode = "ADD" Then
[Code]...
View 1 Replies
Jul 5, 2011
I got this error..The connection was not closed. The connection's current state is open.
This is coding to add data in Ms access in vb...
Imports System.Data.OleDb Public Class Form1
[Code]...
View 5 Replies
May 20, 2010
I'm developing a device app in VB.net that will access a SQL Server database. I need to establish a connection when the app is launched, and keep the connection open until the app is closed. I've done the following:In the Master Module:
Public CNN
As SqlConnection
In the Main menu form load:
CNN =
New SqlConnection(sqlConnString)
CNN.Open()
Then when I want to read from the database:
Dim sqlDR
As SqlDataReader
SQL = "SELECT Name FROM Table"
[code]....
When I run the same code without the global CNN, but rather dim the connection inside the Select function, all works well.
View 6 Replies
Jan 19, 2011
I'm developing an app in vb.net (visual studio 2008). I have a Teradata back-end that will be supporting multiple users in a production environment. I need to use variables in the connection string as the user/pass will be changed every 3 months.
For the gist of the application:
In it's most basic form - I have a search form which works correctly - it pulls results into a listbox and the user then double clicks the list box which will then open a form that is bound via table adapter to the back-end table (Teradata). My connection string is fine everywhere in the application. My problem is using a modified connection string for the "fill" function of the table adapter once the form is opened.
I'm using the code below for the on-load event and keep getting an "invalid connection string" - again, the connection string works fine everywhere else in the app, and the variables etc... are working correctly.
Private Sub adaptertest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DBConnStr As String = "Provider=TDOLEDB;Data Source=TDDEV;Persist Security
[Code].....
View 5 Replies
Aug 26, 2009
I'm facing a problem after installation any software setup that has a database in access(mdb file) How to I transfer file path in our connection string.
View 3 Replies
Mar 11, 2010
I'm trying to insert a new records into database, one of those records is a "datetime"...when I type a wrong date, and try to insert those values into database, i get an error (about wrong typed date etc.)...ok, that's fine, things need to work that way. But here comes the problem, I correct the date, and then try to insert values again...here I get an error from the post title. And this doesn't work until I close that form and run it again...here's part of my code:
Dim cvLicence As New SQL
Try
cvLicence.upis("INSERT INTO blabla (itsnotimportant) VALUES ('something')")
MsgBox("everything's fine", MsgBoxStyle.Information)
[code]....
View 7 Replies
Jun 12, 2011
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
exitwithout()
[code].....
View 1 Replies