Unsurprising since you are trying to write to the port then immediately exiting from the subroutine, and possibly even the program. Put all your writing code inside the try block and check all the information that you get if an exception occurs.
One of these days I'm going to think of a really clever signature.
After a little reading of the .NET Framework documentation for the SerialPort Class, it looks like all you need to do is add the following line of code after your last MySerialPort.WriteLine and before the End Sub so that the transmit buffer is emptied before your program exits the Sub CommPortSetup procedure. See the underlined and bolded area in the information below.
According to the .NET Framework documentation: SerialPort.Close Method Remarks
Calling this method closes the SerialPort object and clears both the receive and transmit buffers. This method calls the Component.Dispose method, which invokes the protected SerialPort.Dispose(Boolean) method with thedisposing parameter set to true.
The best practice for any application is to wait for some amount of time after calling the Close method before attempting to call the Open method, as the port may not be closed instantly.
Hi Friend's, I am using excel 2007. In my file 6 sheets. 4 sheets is data record & 1 sheet is recorder sheet & monthly.
Data record sheet name is : FY_2009, FY_2010, FY_2011, FY_2012 & FY_2013.
In all above sheet :
Part numbers mentioned in column "C2:C60000"
Quantity in column "D2:D60000"
Branch in column "G2:G60000"
Month in column "H2:H60000"
Year in column "I2:I60000"
In some sheet record range in differ. Some sheet upto row 50000 & some sheet upto 38000 but field name partnumber quantity, branch, month & year in same column.
1st case : In recorder sheet i have calculate how many quantity sold part number wise as well as in particular year & branch wise. (Location of part number in A2:A10000 column & Year mention in column F2:J2 (i.e. 2009, 2010,2011,2012, 2013)
2nd case : In column L2 mentioned year (i.e. 2012) & L2:Q2 mentioned branch.(i.e. "HGN", "NGP", "AKL", "AMRT", "CHN", "YTMAL")
How many quantity sold branch wise in 2012 year.
3rd case : In column R2 mentioned branch (i.e. "HGN", & R2:W2 mentioned years 2009, 2010, 2011, 2012, 2013)
How many quantity sold from one branch in year wise.
In monthly sheet i have calculate how many quantity sold part number wise as well as in particular month & year wise.
In monthly sheet location of :
Part number in : "B1" cell.
Months : 1,2,3 ... so on upto 12 in location is B2:M2.
Years : "A4:A8
Presently, i have calculate through excel formula but calculation is slow due to thousand of data records
& thousand of formula. And it will take very long time.
Now i required to calculate through vba micro to speed up our work.
In view of the above kindly let me know.
Note: I am not familiar with VBA.
Sorry i don't have any idea regarding vba micro. And learning through VB.NET it will take time for learning.
If you have any ready made or example program for calculate excel 2007 summing data between column by vba.Post. Thanks for your suggestion.
Hi guys I have little bit Complex Algorithm to solve my little application using IF function.
I'm working on a little game using VB for that.
I have 12 buttons 3*4 three column and four rows. imagine these buttons as river and in the left or on the right side of the river there is a man would like to cross the river using these buttons as bridge.
the basic idea is if user presses the button there is message will show a question Yes or NO. if the answer is correct button turned to green otherwise will be blue if the answer incorrect.
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x = MsgBox("moon is biger than Sun", MsgBoxStyle.YesNo)
If x = DialogResult.Yes Then
Button1.BackColor = Color.Blue
Button1.BackColor = Color.Green
I am developing a simple programe in vb6 with ms access database, currently this programe run in a computer , now we go to work this programe in 4 computer , how can i share the access data base ... now i am using following codes
If I understand it correctly, you want to place the access MDB on one computer, make sure that folder where the MDB exists is shared, then you configure the connection string to reference the MDB something like "...Data Source=\\yourServerComputer\YourShareName\Invoice.accdb"
I have setup a datagrid and successfully filled it with data and always the top left cell is highlighted when it opens. How do I access the value in this cell without clicking on the cell itself? The cell value must be somewhere as it is highlighted when the grid opens.
Any help would be appreciated.If I click on the highlighted cell I can get the value it contains but that's not what I want at datagrid startup.At startup the grid opens in one tab and what I want is to click a different tab and for the value to be used to populate a set of textboxes on the new tab but only when the datagrid is first activated. After that it is no problem as a new set of textbox data is obtained by clicking a datagrid cell entry. I looked on msdn and it talked about a datagrid selection start value but it doesn't exist.
I am currently working in an automation to extract data from IE. I have a scenario where two page will be accessed, the first one is the page without username and password on it and the second one is the page with login page to log username and password...
I am currently working on a code where the condition is if the account is logged is as "none" and level as "Administrator", then the page will be accessed and will be directed to the specific url. but when the account is logged in as "none" and level as "Guest", then will be directed to the login page and username and password will be entered.. the problem is the value or the innertext I am extracting has a <br/> between words, how can I set the condition like this?
[HTML]<divid="userid">Account: none <br/> Level: ADMINISTRATOR</div>[/HTML]
[HTML]<divid="userid">Account: none <br/> Level: GUEST</div>[/HTML]
[CODE]If .Document.GetElementById("userid").innertext = "Account: none " & "<br/>" & "Level: ADMINISTRATOR" Then
Do While .Busy: DoEvents: Loop
Do While .ReadyState <4:DoEvents:Loop.Visible= True[/CODE]
well, due to limited references, this line is the one I use to identify the differences of the page status, (one with no login, and the other one with login).. Anyways, do you have an idea there which should I use in this case instead?... appreaciate your feedback.
I have an application which is near complete, but I never thought it would get this big or desired. The application reads a folder with files in it for user settings, then waits for user input. When input is started, it does specific searches online. When it is doing these searches, the application appears frozen until it finds what the user was looking for and prompts the user for input.
I have tried a few ways to get threading into this, but everytime I get the problem similar to the following.
Cross-thread operation not valid: Control 'ProgressBar1' accessed from a thread other than the thread it was created on.
I tried starting a new thread within the application following http://www.codeproject.com/Articles/15861/How-to-solve-quot-Cross-thread-operation-not-valid and I still get the same problem.
How can I turn my single threaded application into a multiple threaded application?
I am using vb.net 2008
Last Visit: 31-Dec-99 19:00 Last Update: 16-Jan-18 10:09