VS 2010 SerialPort.ReadChar() Takes Hex Returns Decimal?

Nov 18, 2011

I am working on a simple vb project to read data from a PC serial port and write that data to a file.The data is ascii sent in Hex format. I used MySerialPort.ReadChar() to read data and MyStreamWriter.Write(MySerialPort.ReadChar()) to write it to a file.

I copied my code below, sorry about the format.The trouble is: MySerialPort.ReadChar() acts the same as MySerialPort.ReadByte() , both takes the Hex data input and returns data in decimal format.I tried to use Convert.ToChar(MySerialPort.ReadChar()) to covert decimal to char, but it's too slow.I tried decimal.ToChar(MySerialPort.ReadChar()), but VB doesn't recognize decimal.ToChar, even after I installed .NET4.

Did I do something wrong? how to make MySerialPort.ReadChar() to read Hex data and return char?

[Code]...

View 8 Replies


ADVERTISEMENT

VS 2008 Funtion Which Takes Two Integers And Returns One Integer?

Apr 22, 2011

implement MOD(%) function without using the MOD or %. Function should take in two integers and return one integer.

View 2 Replies

Multithreading - Threading Function That Takes Variables And Returns A Datatable

Mar 7, 2012

I've been looking at threading to make my webapplications more responsive. I've found out how to thread a sub that takes no variables and doesn't return anything, but I can't find out how to achieve this for a function that takes variables and returns something. here is an example

[Code]...

View 1 Replies

Takes 3 Percentages(numbers) And Returns An Average Of The Grades In Letter Format(A,B,C)?

Apr 15, 2011

I'm new to coding and i need to make a program that takes 3 percentages(numbers) and returns an average of the grades in letter format(A,B,C). This is what I have so far:[code]......

View 2 Replies

.net - String.Format Decimal With Sign Fixed Number Of Decimal Places, No Decimal Separator?

Jun 27, 2012

What is the cleanest, most readable way to String.Format a decimal with the following criteria

start with a sign symbol (+ or -)
a fixed number of fraction digits
no decimal separator
right aligned
pre-padded with "0"'s

View 3 Replies

VS 2010 70KB App Takes 10MB Of RAM?

Jul 4, 2011

Was just wondering, why would a 70KB application takes almost 10MB of RAM? All the application does is that it shows the amount fo FREE RAM my computer has. It has 2 pictures, an icon and 2 labels. The amount remains the same, it doesn't increase with the passing of time, I just think such a small application shouldn't eat that much memory.

All code is below:

vb.net
Public Class Form1
Dim drag As Boolean
Dim mousex, mousey As Integer

[Code]....

View 5 Replies

1 Serialport 3 Forms - Currently Attempting To Use A Module In Vb 2010 Express?

Feb 26, 2012

I 'm a beginner and have a project that I'm using to turn lights on and off. I need to use separate forms for display on remote monitors. My problem is each form needs the same serial port open to work and the port won't open unless it's closed in the previous form. Using a module works for opening and closing the port, but only for one round. If I try to revisit a form I already accessed it doesn't work.

Public Sub sp1(byval SerialPort1)If Form2.SerialPort1.IsOpen = TrueThen Form1.SerialPort1.Close() If Form3.SerialPort1.IsOpen = TrueThen Form3.SerialPort1.Close() Form1.SerialPort1.Open() end sub
Public Sub sp2(byval SerialPort1) If Form1.SerialPort1.IsOpen = TrueThen Form1.SerialPort1.Close() If Form3.SerialPort1.IsOpen = TrueThen Form3.SerialPort1.Close() Form2.SerialPort1.Open() EndSub
Public Sub sp3(byval SerialPort1) If Form1.SerialPort1.IsOpen = TrueThen Form1.SerialPort1.Close() If Form2.SerialPort1.IsOpen = TrueThen Form3.SerialPort1.Close() Form2.SerialPort1.Open() EndSub
end Module

View 2 Replies

VS 2010 Can't Enable A Timer From A SerialPort.DataReceived Event

Dec 16, 2010

So I just spent the last 4 hours trying to find out what was wrong with my code, just to find out that there's a bug in this version or I just don't have enough knowledge of VB2010 (I'm coming from VB6, this is my first program on 2010)I removed the rest of the code just to point out the problem, here it simply tries to enable the Timer1 when you receive data in the SerialPort1

Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If Me.Timer1.Enabled = False Then

[code]....

After this I found that the code inside the Timer1 didn't run when the 100miliseconds passed, so I added a msgbox to see debug.

Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If Me.Timer1.Enabled = False Then

[code]....

View 16 Replies

VS 2010 Unable To Access DataSet Inside SerialPort.DataRecieved?

Jan 23, 2011

I have created my own object, wich contains a SerialPort. I have a sub in my object wich handles the .DataRecieved-event. I'm trying to access my DataSet from that sub, but for some reason I'm unable to do that. It keeps telling me that my tables contains 0 rows, but I'm 100% sure that they contains several rows.

View 10 Replies

VS 2010 - SerialPort Lagging - Serial Port Is Open And Waiting For Some Signals From The Dyno

Sep 9, 2010

I have things set up so that the program is ready to start logging ,only when Recieving=true.This is controlled with Button1. So I click button1,Serial port is open and waiting for some signals from the Dyno.When 1 signal come it put a "1" in TextBox1 ,and for the second a "2" and so on. Thing is sometimes it starts right away, like I want it to,and sometimes it lags a fraction of a second, even though the Port is open.When it lags there are already 5 to 10 signals gone by before it starts logging 1,2,3,...and so on. Sometimes it don't start at all.Then I have to close and re-open the form and it works,but with lagging on the first "set"

"Textbox1 > 0 then" triggers a timer (not seen in this code)that samples Textbox1 once pre interval and writes the value to a listbox. On the upside as soon as a "1" is displayed in textbox1 the timer starts like it's supposed to.I noticed this behaviour before I added the timer and besides the timer has nothing to do with the signals coming from the SerialPort. I have my form setup so I can run "sets".Run one "set"...save...reset...run another "set" ...and compare.It's always the first "set" thats off.If I run multiple "sets" the first one is completely "whacked", and the rest are consistent.

Think this could be the SerialPort lagging,or code problems?

Public Class Form1

Dim resetValues As Boolean = False
Dim RPM As Double

[CODE]...

View 19 Replies

Visual Studio 2010-VB-Change The Form_Designer Takes Up To 1 Hour To Process

Nov 9, 2010

Every time I make even a very small change to a form in the form designer, when I try to move off the screen to write code, or run the application, VS 2010 takes up to 1 hour to figure out what the small change was, process it and then let me continue. Is there some fix that I am missing to make VS 2010 be able to handle small changes to the form_designer, or is this just the way it is?

View 6 Replies

VS 2010 Make A Program Which Access The Internet And Takes The Source Code From The Webpage

Mar 6, 2011

I've been trying to make a program which access the internet and takes the source code from the webpage. I've copied this code from the internet:

[Code]...

View 2 Replies

VS 2010 Function Returns Only 1 Letter?

Nov 25, 2011

Im making a login system that encrypts and decrypts the username and password. My encryption code is:

Private Shared Function enc(ByVal targetString As String, ByVal maskvalue As String) As String
Dim Index As Integer = 0
Dim ReturnValue As String = ""

[code]....

The enc function works for both encrypting and decrypting (I've tested with a MsgBox alert. The problem I'm having is when the program loads, it reads the file and decrypts it. However, instead of properly working, it returns one character in the first textbox and nothingin the other without any error being thrown.

View 1 Replies

VS 2010 Override What The Index Returns?

Aug 30, 2011

I have a class that inherits List<T> [this is a C# project, but it can relate to VB.net] but I want to know if there's a way to force the index to return something else....let me give an example:

In the original List<T> implementation, whenever you call for an item on the list, like so:this[0];You get whatever T is. What I want to do is override that, and grab whatever T is, then return a certain value of T.

View 1 Replies

VS 2010 Returns In A Using Statements - Do They Trump One Another?

Oct 30, 2011

This is just a simple question I'm sure, but while coding I just realized that possible this could cause me some problems. My knowledge still of Using blocks and returns is fresh. But as far as I know once you return something, everything stops dead in it's track because you have your answer and theres no need to continue.

So I was wondering if I had a Using statement and a return nested within it does it still process the using as should? IE. disposing and cleaning up resources afterward.

View 2 Replies

VS 2010 XML Searching Returns As Non-existent Value

Oct 22, 2011

I am trying to search and XML file for a variable on a specific node. Following a tut I can setup a search for the node correctly and it returns its name - but it doesn't find any values for any children of that node.

I get this error:

Faster_2 is neither a DataColumn nor a DataRelation for table Skill. Area Highlighted:


ListBox1.Items.Add(dv(index)("Skill_Name").ToString() & " " & dv(index)("Faster_2").ToString())

Here is my VB

[Code].....

View 2 Replies

VS 2010 : Xpath Query On A XML Returns 0 Results?

Nov 13, 2011

I've converted an html to XML and now i want to get all the child nodes nested within a DIV element with a specific attribute (class="itemInfo").Because the html that the XML is based on changes from time to time i want to use a more "safe" relative root,
(something like : "//div[@class='itemInfo']").Problem is that i always get 0 nodes ...

Dim doc As New System.Xml.XmlDocument()
doc.Load("products.xml")
Dim root As System.Xml.XmlElement = doc.DocumentElement

[code]....

View 6 Replies

VS 2010 Function Returns Same Value / But When Checked To Be Equal Says Otherwise?

Mar 13, 2011

Code Block 1 First I am calling my function to obtain a pixel color at a specified coordinate.[code]The odd part is while looking at the results as a string they appear to be the same, but while using If Not TheColor.Equals() in code block 2 the program returns that they are different. Before threading code block 2 this was not a problem so I can only assume the threading is causing the problem. I'm unsure as to how I can fix this... Additional unrelated problems I am having are:

- On WindowsXP the colors being read are not the actual color as which the mouse is located.

- While using print-screen there seems to be a bit of lag and some times unreliability, is there another method to get a pixel color at a specified location? Note that GetForegroundWindow works on Vista/7 but not XP, and GetActiveWindow is unreliable.

View 5 Replies

VS 2010 String.Length() Returns Null

Jun 11, 2011

[Code]...

By my logic, this should only assign .length to index IF the length of strItem is longer than 0. This check is there in case the listbox is empty, or the user has not selected an item. However, everytime I go through this code without an item selected I get:

[Code]...

View 4 Replies

VS 2010 Webbrowser Returns Page Differently Than IE Alone?

Apr 3, 2011

When I use IE8, it displays the page fine, but when I use the web browser control in VS 2010, it shows the page differently (in a bad way).

View 12 Replies

VS 2010 Reading Excel Returns Some Rows As Null

Oct 25, 2011

I have a vb.net app that I can read a .xls file into a dataset or loop through as oledbdatareader and it gives the same result.Some of the rows have all nulls when I loop through them but if I open the same file in Microsoft Excel I can see that row fine.[code]From the info above the first two SKU values would come through fine but when I get to the 3rd row it would show a null.Is it possible that it kind of inherits the first rows type and since the 3rd row isn't all numeric if nulls it? [code]

View 1 Replies

VS 2010 Reading Remote Registry With WMI Returns No Results

Feb 9, 2012

I am trying to read the HKEY_USERS hive of a remote machine with this Class

Imports System.Management
Imports System.Management.Instrumentation
Public Enum RegHive As UInteger

[Code]....

The value of sSubKeyName is the user's SID + "" + Network (e.g. S-1-5-21-1606980848-2025429265-839522115-560021Network). Now under that key are various subkeys containing mapped drive letters. But it never returns anything.

Strangely, if I use the OpenRemoteBaseKey method it works BUT I don't want to use that because using WMI lets me specify alternate credentials and OpenRemoteBaseKey doesn't

View 1 Replies

VS 2010 Time/Date Stamp To Mysql Returns 0000-00-00?

Aug 10, 2011

Im having a problem passing a date and time stamp from vb to mysql. My code is as follows:ComboBox1.Text.ToUpper() & "', '" & TextBox1.Text & "', '" & Now() & "'"Where the comboBox populates the first field, the textbox populates the second and in the third I get 0000-00-00 00:00:00. I have formatted the field as date and time - which is what I am after

View 8 Replies

Convert A Decimal ( Decimal Place Holder = Dot) To A Decimal (decimal Place Holder =comma)?

Dec 20, 2010

how do you convert a decimal ( decimal place holder = dot) to a decimal (decimal place holder =comma)?

View 6 Replies

.net 2010 Removing Decimal Places?

Feb 3, 2011

in my application there's Textbox1.text, Textbox2.text, Textbox3.text and Button1.

my code is:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End Sub
End Class

View 8 Replies

VS 2010 - Converting Base36 To Decimal?

Jan 2, 2012

What code should I write to convert a Base36 to decimal?

View 6 Replies

VS 2010 Only Allow 1 Decimal Point On Textbox

Feb 20, 2012

I got this class from another vb help forum and I'm using it for fields that accepts monetary values. Is there a way to incorporate a '1-decimal' point only rule?ATM, I can enter values like this: 1.2.2.20000..I need to limit the number of decimal points used. (1.0000)[code]

View 7 Replies

VS 2010 Table Of Decimal Equivalents?

Jan 12, 2011

I'm having some problems understanding how this may work. This program is supposed to give convert 1-255 from Decimal to Octal, Hex, and Binary and display them in the outputTextBox with the headers listed as such (above). I can't seem to get the headers to show up correctly and using the book example only gets me this error "Items' is not a member of 'System.Windows.Forms.TextBox'".

Public Class Form1
Private Sub outputTextBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles outputTextBox.Click
Dim sTemp As String = ""

[code]....

View 15 Replies

OdbcDataReader In Showing Decimal Fields Decimal Separator Disappear With DB2 Dsn?

Oct 19, 2010

OdbcDataReader in showing decimal fields Decimal separator disappear with DB2 dsn

View 3 Replies

VS 2010 Format Textbox To 2 Decimal Places?

Nov 14, 2011

I am trying to format a textbox so it reset itself to 2 decimal place on leave.

So someone types in 10.899 and when they leave the textbox it will format to 10.90.

I have tried this: Textbox1.Text = String.Format("{0:n2}")

and I get this error:{"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."}

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved