f



To select from a list of comports in a program ?

Currently i have compiled a program using just Com1, and it works fine. 
But, if i want to move it to another computer where i just _cant_ use 
that port, it would be nice to put some code in the original program an 
recompile it further.

It is with use of -Net 4.0 this and so far i've used the 
Serialport.Class that is included there.

Is there a way i can put a code in the Form Load() event to select from 
various ports i can select from here..: (another form in the project)

Public Class PortValg

     Private Sub PortValg_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load
         For Each sp As String In My.Computer.Ports.SerialPortNames
             ListBox1.Items.Add(sp)
         Next
     End Sub

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click
         Dim port As String = ListBox1.SelectedItem
         My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\VB 
and VBA Program Settings\VR5000", "Comport", port)
         My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\VB 
and VBA Program Settings\VR5000", "Baudrate", "9600")
         My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\VB 
and VBA Program Settings\VR5000", "Stopbits", "2")
         My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\VB 
and VBA Program Settings\VR5000", "Parity", "None")
         Me.Hide()
     End Sub
End Class

0
neitakk (1)
3/6/2011 11:52:17 PM
comp.lang.visual.basic 2233 articles. 0 followers. please859 (33) is leader. Post Follow

0 Replies
603 Views

Similar Articles

[PageSpeed] 43

Reply:

Similar Artilces:

Programming Windows CE 2 in Visual Basic or Visual C++
Hi, I've been searching the web for ages, looking for some software that will allow me, with my Phillips Nino 3xx PDA running Windows CE2, to program in one Basic or C++ Visual and make a compiled program to be able to install on my PDA device as other software. I've only found software for PocketPC etc... I'd like it is I could program it on my laptop using Visual Basic and with a form for the Windows CE screen etc.. Thanks. If someone can help, please reply or email. On Sat, 07 Aug 2004 14:49:20 +0800, Johan Kahn <johankahnSPAMKILL@westnet.com.au> wrote: >Hi, >...

programming in visual basic
write a program in visual basic to generate a difference table for a specific function inject a delibrate error into your table and comment on the behaviour of the data "Thaiwo" <taiwokaffo@hotmail.com> wrote in message news:1166209715.771333.83160@80g2000cwy.googlegroups.com... > write a program in visual basic to generate a difference table for a > specific function inject a delibrate error into your table and comment > on the behaviour of the data > No. ...

Lists in Visual Basic
Hi there, I'm working in Excel 2002, SP3. I have the data with the following format - APC (Name : APC77) (Value : 200) APC (Name : APC3157) (Value : XXX) APC (Name : APC1406) (Value : 2000) APC (Name : APC1426) (Value : 90) APC (Name : APC74) (Value : 250) APC (Name : APC3680) (Value : 10) APC (Name : APC3683) (Value : 100) BPC (Name : 3318) (Value : A) (Desc : (old)) BPC (Name : 3143) (Value : A) (Desc : (new)) BPC (Name : 3526) (Value : A) (Desc : (new)) BPC (Name : 3678) (Value : A) (Desc : (new)) BPC (Name : 3131) (Value : A) (Desc...

How do you end a visual basic program???
I'm having intermittent problems where I can't delete my VB6 executable. If I try to compile, VB6 says it can't overwrite the old executable file. XPSP2 can't delete the file, but I can copy another (completely different file renamed the same) file over it, but still can't delete the new file. Last time this happened, I saw two error messages from XP. 1) remove write protection and 2) somebody is using the program...or words to that effect. This time, I'm only getting the write protection message. If I reboot, the file is deletable. I'm perplexed. The progra...

How to interrupt a Visual basic program.
I am writing a Visual Basic program which may run a long time. The main part of the program is shown below. I also have a command button which is supposed to unload the form and ent the program. The program ignores the stop command button. How do I close the close the program without resorting to ctl-alt-del ? thanks *************** main part of the program *********** Private Sub cmdStart_Click() Dim more As Boolean Dim i, n, x As Long more = True While more = True ' ' program is iterating here waiting for more to go False ' Wend End Sub *************** mthe stop command ...

Visual Basic File programming
Hi All, I'm new in VB programming, i want to create program with VB 6.0 to checking size one windows file every 30 minutes periodically. and if that file size (larger than) 1 mb --> file will be deleted automatically. can anyone help me thanks "ardi" <void_108@yahoo.com> skrev i en meddelelse news:1178610449.233770.250770@y80g2000hsf.googlegroups.com... > Hi All, > > > I'm new in VB programming, i want to create program with VB 6.0 to > checking size one windows file > > every 30 minutes periodically. and > > if that file size ...

Visual Basic Sample Program
hello, Visual Basic Programmer I'm lukas and I'm visual basic programmer. I had created some programs created using Visual Basic 6.0 it's very interesting . If you want to share Basic programs with me send an e-mail to lukas_sahardiman@yahoo.com and I'll send you my maiden program..... ...

Running a program from Visual Basic
Could someone show me how I could write a little code to open 'A.bmp' in Paint, and save it from Paint in 16 colours by using SendKeys or some better way? Thanks very much. In article <fgn7ij$9kf@aton.abo.fi>, beginner <not.this@address.spam.no> wrote: >Could someone show me how I could write a little code >to open 'A.bmp' in Paint, and save it from Paint in 16 >colours by using SendKeys or some better way? Thanks >very much. Surely this can't be impossible or a very stupid question. I have seen that I can start programs with Shell and it is...

How to program an input selection list
Hi, When I input my email address on this website, it provides a drop down box with two of my email addresses. The right bottom corner has a few 45 degree lines to indicate the user can change its size. Do you know how to create it? I could not find the code in the source. Thanks a lot. In article <88d928c2.0409100845.71699002@posting.google.com>, jenny_jones_79 @hotmail.com enlightened us with... > Hi, > > When I input my email address on this website, it provides a drop down > box with two of my email addresses. The right bottom corner has a few > 45 degree lines...

Decompiler of Visual Basic programs.
> http://www.vb-decompiler.org/index.php?p=Products > http://www.vb-decompiler.org/files/lite.rar > > Description: > Decompiler of Visual Basic programs. > > - Decompiling forms (frm and frx) and usercontrols (ctl) object files; > - Fully p-code decompiling (with parsing opcodes to standart vb > instructions, with decompile GUID objects); > - 2 p-code decompiling modes (with stack parsing or without stack > parsing); > - Disassembling native code procedures (with power Pentium Pro > disassembler, supporting MMX and FPU instruction sets); > - Syntax ...

Selling of a visual basic program
Is it completely legal to sell, or give away (for free) programs that are created in Visual Basic 6.0. I know this may sound like a stupid question, but I would like reasurance of this, before I buy VB 6.0. PS Please post ASAP, as I need to know within 20 hours (as I want to buy from ebay and the auction closes in about 20 hours from now). Thanks, James. You can sell, distribute, or give away applications created in VB.... -- Chris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp Veign's Blog http://www.veign.com/blog -- "James" ...

List of lists of lists of lists...
I would like to have a list of lists N times deep, and my solution is (in pseudocode): def deep(x): a=[x] return a mylist=[] for N: mylist=deep(mylist) Is there a more elegant way to do it? The maine idea is: from a list having the numbre of steps along N dimensions, generate a list with an item at each possible point. Example 1: N=2 list=[2,3] result=[[1,2],[1,2],[1,2]] Example 2: N=3 list=[3,1,2] result=[[[1,2,3]],[[1,2,3]]] -- Ángel Gutiérrez Rodríguez - agr@fq.uniovi.es Instituto de Ciencia de los Materiales de Madrid - CSIC SpLine - European Syncrothorn Radiat...

Active Lists in Basic Program
Is is possible to have two active lists and therefore do two READNEXT's at different places in a BASIC Program? We are running on D3/Linux version 7.2. Thank you. Bob Marik Yes, [I think!]. See the syntax & documentation for the "SELECT TO selectvar" BASIC command. It would work something like: [pseudocode - no flames please] Build and execute first selection statement. If something selected, select to firstlist * Build and execute second selection statement. If something selected, select to secondlist * Loop Read firstkey from firstlist else EOF ...

master select list changes contents of slave select lists
I have one drop-down list (call it master) that needs to change the contents of other drop down lists (slaves). Really, its changing which item is "selected" or on top of the slave lists, but same idea. Can this be done with Ruby and html? Would I need some sort of on_change listener on the master? And then a way to change the "selected" attribute on the slaves? I am using Ruby and Sinatra. Any help, or key words to look up, greatly appreciated. I have only a few weeks experience on Ruby and HTML. Thanks. -- Posted via http://www.ruby-forum.com/. ...

Web resources about - To select from a list of comports in a program ? - comp.lang.visual.basic


How to comport yourself like a proper villain whilst traveling: Via Automobile.
As a villain you, undoubtedly have appointments and carefully planned schedules that must be kept. Therefore a ruthless efficiency in travel ...

Kirsten Powers: Obamacare Delays Like Kill List, Don’t ‘Comport with the Constitution’
... supporters who are insisting that Obama should have flexibility while implementing the law are advocating for behavior that does not “comport ...

When a Headline doesn’t Comport with Content
Daniel Halper has a post up at The Weekly Standard entitled Gregory Mocks LaPierre for Proposing Armed Guards, but Sends Kids to High-Security ...

DHS chief: Immigration enforcement ‘needs to comport with American values’
In an exclusive interview with ABC News , Homeland Security Secretary Jeh Johnson said the Obama administration’s new plan for deportations will ...

Romney Says Obama's Philosophy is "foreign to" and "does not comport with the American experience"
Romney's really going full-speed ahead with this " Obama = Evil Foreigner " business: I just think it's kind of weird to remount Sarah Palin's ...

Resources last updated: 1/24/2016 4:00:46 AM