Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How To Select A Line Through Code?

i want to select a line through code.

How can i?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Select Node,then Select Link,then Make The Line To Link
dear all:
when i implement it the coding which i switch to comment one..
and all can;t run oledi.
actuall i want to choose the node, then choose the link, after that when i fill the text box(txtsrc) from 1 , then to (txtdes) 2
then the line will connect from node(com pic) to node2.

that's all,..

Select Node,then Select Link,then Make The Line To Link
dear all:
when i implement the source , then having problem, pls help me
to solve it.....


I Need To Select Every 4th Line
I have a list of about 2500 lines of data and have to pick every four for a select list. In other words, pick one skip three then pick the next record and so on. Is there a way you know that this can be done automatically? It would really help me out

Select Line In RTB

I would like to select a whole line from within a rich text box, so that when I clicked on one of the lines, it selected that line.

I have a richtextbox full of strings such as the following:


Each string is on a new line. I would like some code, so that when you clicked anywhere on one of the names (e.g. Richard) it selected the whole of that name, from R to d.

Now I know I could have used a listbox, but I deliberately chose to use Richtextbox for formatting purposes.

Any help would be appreciated,



Select A Line In A RTB
Hello! All i want to know is, how can i select a SPECIFIC line? The
whole line! I mean, all i have to do is run an index number
through it and it will select that line!

Lets say if i want line 2 selected...the second line in that RTB will
become selected.... make sense? Can anybody help me?

How To Select A Line In A VbalGrid?
Hi there!
I have a vbalGrid in my VB 6.0 application. Once the form is loaded and the list populated with data, I want the first line to be selected by default, if any. How?

Select Line Input
ok dumb question.
i have a text file and i have a password on the first line and then the login name on the second.
how do i stick the login name in a variable. (told you it was dumb)

Select Line Word Vba
If you double click in the margin of word the entire line is selected.

I wanted to use the macro recorded to write a macro which selects the entire line. However, the macro recorder does not let me use the mouse in word.

2 questions

1) Is there a way to write a macro to select a line?
2) Why can't the mouse be used when recording a macro?

ListView Select Line
How can i select a line ?

I want it like if i was pressed the mouse on a line I do not want to have the line selected with :

VB Code:
Set ListView1.SelectedItem = ListView1.ListItems(2)ListView1.ListItems(2).Selected = True

Want To Select A Word From Line Using Right Click
I want to select a word from a line of RichTextBox using rightclick of mouse............ is there any way to do this..........

I've sleceted a word from the line of Rich TextBox but by using LEFT click of mouse n = InStrRev(txtSpellCheck.text, " ", txtSpellCheck.SelStart)
this code work fine but only with left button click
but I want to do it with righ click

Select Text By Line In Richtextbox

Should be an easy one but Im at a blank on it.

How can i select the first letter of a line in a richtextbox?

but like

VB Code:
Function SelectChar(byval nLineNumber as Long)  End Function

I want to be able to select the character by linenumber
so SelectChar(1) would select the character on the first line


How Do I Select A Certain Line Of Text In A .txt File?
How can i select a certain line of text in a .txt file?

Say line 4

and then how do i make it select like the 4 word in that row?

so that then the text is out in a text box.

How To Select Recording Line In The Mixer
we can select recording line from the volume control of system tray, does anyone know how to select recording line in vb ?

Can VB Execute Code Line-by-line
Hi tek-tip pals,
 Is there any way for VB to execute code line-by-line like in the compiler languages? I mean,
if, for example I have a form with a command button and a label
then I apply this code to the command_click function:
 For t = 0 To 20000
 Next t

The only time the label will display anything is when the entire
process is finished. How can I make it execute each line completely
before it executes another because in an application, the user needs
to know what's happening.

Draw A Line To Select Controls In A Picture Box
This seems easy, but I am trying to figure out the best way to do this. I have a picture box in which I have drawn controls. I would like to provide the ability to 'select' the controls (just like the VB ide) by drawing a box with the mouse. When I use the .Line method on the picture box, the line shows up behind the other controls. Other suggestions?

Thanks ...

Select The Recording Line Using The MCI Mixer APIs?
I recently asked for help to record the sound from the recording devices, and I was refered to a nice program:

The problem is that I need to record both the microphone line, and the wave output, and the user must choose the options using Windows, this is a problem since the configuration may be lost after an OS format or something else, and he may not remember about changing the recording config again.

I've looked a bit at some code examples out there, but I haven't found something (more or less) simple that gives me the exact answer to my problem. I know both the selected devices, and their volume can be controled through APIs, but I don't know how to do it since I've never worked with sound (in any programming language I've had experience), plus the recording devices (at least their name) change varying on the sound card...

Any help??? Thanks in advance.

How To Select A Line Or Circle Or Curve At Runtime
Hi. I have written some graphics code using VB 6.0. I wonder if anyone knows how I can I create codes that allows me to pick or select one of the entity that I have generated during runtime. The program create a line between two end points in the picbox. It also allows user to create a circle around the picbox. Then it allows user to create a curve (points) based equation. Finally, it allows user to generate a line based by specifying
two points using form2.

Form 1 :

Private Sub DrawCvCmd_Click()
Dim n As Single
picbox.DrawWidth = 1
For n = 0 To 100 Step 0.2
picbox.PSet (n, Sqr(n)), vbMagenta
picbox.CurrentX = 55
picbox.CurrentY = 12
picbox.Print "y = Sqr(X)"
Next n
End Sub

Private Sub drawlinecmd_Click()
picbox.DrawWidth = 1
picbox.Line (0, 0)-(100, 100)
picbox.DrawWidth = 4
picbox.PSet (0, 0), vbBlue
picbox.PSet (100, 100), vbBlue
picbox.CurrentX = 55
picbox.CurrentY = 55
picbox.Print "y = x"
End Sub

Private Sub clrcmd_Click()

End Sub

Private Sub DrawCirCmd_Click()
picbox.DrawWidth = 4
picbox.PSet (50, 50), vbBlue
picbox.DrawWidth = 1
picbox.Circle (50, 50), 50, vbRed
picbox.CurrentX = 50
picbox.CurrentY = 50
picbox.Print "Centre of Circle (50,50)"
End Sub

Private Sub EndCmd_Click()

End Sub

Private Sub Form_Load()

picbox.Scale (0, 100)-(100, 0)
picbox.DrawWidth = 2
picbox.Line (0, 0)-(0, 100), vbBlue
picbox.Line (0, 0)-(100, 0), vbBlue

End Sub

Private Sub GPt_Click()
End Sub

Private Sub SpdrwCmd_Click()
End Sub

Form 2:

Private Sub OKCmd_Click()
Form1.picbox.DrawWidth = 1
Form1.picbox.Line (x1, y1)-(x2, y2), vbBlack
Form1.picbox.CurrentX = x1
Form1.picbox.CurrentY = y1
Form1.picbox.Print "(" & x1 & "," & y1 & ")"
Form1.picbox.CurrentX = x2
Form1.picbox.CurrentY = y2
Form1.picbox.Print "(" & x2 & "," & y2 & ")"

End Sub

How To Select Part Of A Line From A Text File...???
Hi guys,

I am still a newbie.. so if you would please bear with me...

I have a text file that i read in all the lines..
each line is a record.

I then want to select just the right side of the line, because that will be the actual email address.
it has no spaces, so , i need a way to select from the right until the first space, and I guess back one, since i don't want the actual space used..
so, i guess i would start at the end of the line and then go to the left until i hit a space and then back one, and select that.. but i don't know how...i have been checking the help files and searching this board, but i cannot find it...

here is a sample line

kevin rea

so, i want to select just the email address from this, the part on the right of the line,

kevin rea

ListBox Item Drag && Drop And Line Select

Below is the code (obtained from this forum but I cant remember from who) that I use to move lines in a listbox up or down by dragging and dropping them.

Option Explicit

Dim sCurItem As String
Dim iLastIndex As Integer

Private Type POINTAPI
X As Long
Y As Long
End Type

Private Declare Function LBItemFromPt Lib "comctl32" _
(ByVal hwnd As Long, _
ByVal ptx As Long, _
ByVal pty As Long, _
ByVal bAutoScroll As Long) As Long

Private Declare Function ClientToScreen Lib "user32" _
(ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Private Sub Form_Load()
With List1
.AddItem "Item1"
.AddItem "Item2"
.AddItem "Item3"
.AddItem "Item4"
.AddItem "Item5"
End With
End Sub

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbRightButton Then
GoTo RBjump
sCurItem = List1.List(List1.ListIndex)
iLastIndex = List1.ListIndex
End If

End Sub

Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim iCurIndex As Long

If Button = vbRightButton Then
GoTo RBjump
pt.X = X Screen.TwipsPerPixelX
pt.Y = Y Screen.TwipsPerPixelY

Call ClientToScreen(List1.hwnd, pt)

iCurIndex = LBItemFromPt(List1.hwnd, pt.X, pt.Y, False)

If iCurIndex > -1 Then
List1.RemoveItem iLastIndex
List1.AddItem sCurItem, iCurIndex
End If
End If
End Sub

The code works great for moving lines about but I also need to be able to highlight a line just by clicking on a line, the above code wont let me click and highlight a line, cant work out why.

Any ideas.


How Do I Get Code Line Numbers In VB6 Code View?
Hi how do I get numbers at the side of my code in VB6??

Am using Dreamweaver Mx and I have numbers at the side on that. It really helps.


1 <html>

I want to display numbers against my code lines like that. Can this be done in VB6. And if so how please.


Need VB Code To Insert A Row For A Subscripted Line In Excel & Code To Search For Amounts On One Sheet And Apply Them To Certain Area On Another Sheet
I am in the process of developing an Excel spreadsheet and need assistance
in adding visual basic code to automate it.

The first thing I am trying to do is to create a macro where a user can
click on a certain button, and the program will insert a row at a specific
row and will copy all formulas associated with the row above it. For
instance, if you have a spreadsheet that has 10 rows and 3 columns in it,
you can insert a subscript line below row 5 and call it 5.1. When the
subscripted row "5.1" is added, it will include the same formulas as in row
5, which would add columns 1 and 2 in column 3.

The second thing I am trying to do is have some code that if a user enters
information on Sheet B that needs to also be included on Sheet A, the code
will search Sheet B to see it an entry made on Sheet B should be carried to
a particular row in Sheet A.

I would greatly appreciate any feedback anyone can give me regarding this.
Thanks in advance.

Whats The Code To Put Your Code Onto The Next Line
whats the code to put your code onto the next line without it affecting anything.. eg because i cannot write any further on the same line..



What is the ADO substitution for the following command?

dbs.Execute _
"Select co_id, co_name " & _
"Into table1 In '" & strExternalDB & "' " & _
"From company"

SELECT-INTO doesn't work in ADO and I faced error when I use ADO connection instead.


Am in a slight dilema. In my ListView I want to display ALL the movies in the database. But when I select the title in from the ListView, it should display the details in the HTML page. What is causing my dilema is that, I have the following tables movieinfo table, genre, producer (supporting tables) among others. genre, producer tables are represented in the movieinfo table by their Ids eg genreId, producerId. Now, if I display all movies in the ListVieW, I end up displaying the Ids of the supporting tables instead of the corresponding names in HTML. How can I ensure that I display the names instead of IDs? I tried doing a query which displayed the names BUT instead of displaying ALL the movies in the ListView control, it only displayed movies meeting the set criteria. This gives a false impression eg the total number of movies are 120 but when i do aquerry and say i need to display the name of the producer, I get 50. This is coz not all movies were captured with the producer field. The producer field is NULL therefore it is not a must that it be captured.

Select All Code
What code is used with a Rich Text Box for the Select All item in a menu?

I thought it was the code below, but this doesn't seem to work.
Well, I think it selects it, but it doesn't highlight it.

VB Code:
rtb1.SelStart = 0 rtb1.SelLength = Len(rtb1.Text)

*select* Code
Hello every1,

I just need for someone to tell me the code that will tell me which one of my option buttons are selected... They are in an array 0-13... I just need to be able to get the caption of the selected button...


Select ALL Code
I am new in the vb word, and I am trying to add a [Select All](ctl-A) menu selection under the Edit option. Does anyone wrote code for this.
If you had, could you shared with me. Thanks

Select Tab From Code?

Is it possible to select a certain tab on a tabstrip in code?

For example, I have a form with a tabsrip with 3 tabs. I have a command button that when pressed, will select tab 2.

Any help and example code would be appreciated..


Multiple Select With Code?
How do I select multiple items from a listbox with code, using the listbox.text and the listbox.listindex properties?

Vb Code In Select String
Is there any way to do something like this:

Set rst = dbs.OpenRecordset("SELECT ID FROM table, where ID=textbox.text ;")

im not good at explaining at all but i hope you understand.
Thank you

Select A Row By Code In Datagrid

in my current vb6 project i use datagrid and ado recodset. my purpose is to to select an entire row by code - exectly like the user do it manually - the entire row should be shows as selected ( blue background) .

i tried to do it with the regular methods/properties of datagrid but without sucuess.

can someone know hot to do it?

How To Select Printer By Code?
I want my program to have a combo box that contain all of system printer's name and allow users to choose the printer for their job. How can I code my program? I don't know about printer's object, functions and API to complete it!! Could someone help me please?
Thank you.

How can I set a <INPUT type=FILE> tag with client-side code? You cannot set the value from the client with code.

How To Select A Value From Combo-box Using Code And Not Manually?
How can I select a certain item from the COMBO-BOX list?
I know the value I need from the combo list, and do not know the index of it, and want to select it through vba, and not manually.
How do I do that?

I use Microsoft-Access 2000

Thanks very much

Code To Select A File For Processing
I have a custom application which is used to read existing database files, find their field headers and publish these in a listbox and then reformat some of the fields to be attached to new field information. I presently have my Drive and Directory and File listboxes functioning so a user can move to the place where the desired file can be located.

What I want to do next is have the user Double-Click the file he/she wants to process. In double-clicking the file name in the file listbox the filename gets transferred into a textbox. At the same time, I want some behind the scenes code to determine what the fields are for that file and to publish those fields in the order in which they are encountered in another listbox. From here I want the user to be able to select a field and press a command button to send that field to a third listbox. When it moves it disappears from the field list it came from.

Can somebody give me some ideas as to what code segments will transfer the file from the file listbox into a textbox and how I can read the field headers and send that list to another filebox? I am wanting to process MS Access files (mdb), so I will also need some guidance as to how to connect to the database. If the file is not mdb then I will attempt to make sure it is .dbf. Does this change the way the program will have to read header info to extract out the fieldnames?

Multiple SELECT Vs Code Cycle
For exemple:

I have the following table

ID / Class / Graph

I select the ID's with graphical representation with

rst1 = SELECT ID, Class FROM Prod_table WHERE Graph='YES'

After I retreve the ID, I have to get the name of the product in a Table Dictionary


ID / Name / Lang
A32 Name UK UK
A32 Name FR FR
A32 Name GR GR
B56 Name UK UK
B56 Name FR FR
A28 Name UK UK
. . .
. . .


I have to make a cycle to retrive the name in UK

rst2=SELECT Name FROM Dic WHERE (ID='rst1.ID' AND Lang='UK')
'other lines of code...

IT's possible to make something like SELECT Name FROM Dic WHERE (Lang='UK' AND ... every unique ID in Prod_table)
in a single query...

Get the ID with the Class and Name in UK without the cycle of code ???

Executing Code On Tab Select And On Unminimize
Ok, how can I execute code when I select a certain tab? And how can I execute code when the program unminimizes?

Combobox Select/Insert Code
Hi all,

I have a combobox on my form. The combo is currently populated by values from a table in a DB. I have two questions:-
1- Suppose I need to select more than 2 items in the dropdown, how can I ascertain the selected items?

2 - I want my users to check in the combobox dropdown if what they are looking for is already available in the DB if NOT available, then I want to allow them to type/key in the missing item directly in the combobox is this possible?

If the answer is yes, please let me have a sample code of how I can code that.


Listview Select Problem - Run Code
I have 4 items in my listview, the listview in in large icon mode.
I want it so that when a user clicks on item 1, a peice of code activates, and do that for each of the 4 items, each peice of code is different. I was thinking about doing it in a select case, but I don't know how to, I am using Thank you for you time,
- Gabe

How Do I Add Code To A Select Case Statement
I want to add text1.text to the following Select Case Statement:

Select Case cboApt.List(cboApt.ListIndex)

Case "AMS": Aptelev = -12
Case "HUY": Aptelev = 120
Case "LCY": Aptelev = 16
Case "MME": Aptelev = 116
Case "NWI": Aptelev = 60

End Select

and the I want to add (another textbox) aptelev.text to the end of that statement which is the figure bit.

How do i code it?

What I mean is.. I have a text box and whatever is entered into this textbox is added to the bottom of the list of the Select case Statement.
then, another textbox takes the value of the Aptelev which will be appended to the end of the first text box entry at the end of the Select Case Statement.

How do i code it?

Can Code Select A Random File Name?
I am saving the contents of a textbox to a .txt file. I will be doing this every 45 minutes. I don't want to overwrite each file. Is there a way to write code which would automatically select the save name? for example as a date or time, or tick? or a sequential number? Using

Select A List Item Through Code
Please help me with something elementary! How do i select one particular item in a drop-down list box using code? i want to do this as the default selected item.

Thanks in advance

Select Combobox Item In Code
i've populated a combobox with records from a database like this:

VB Code:
rs.CursorLocation = adUseClientrs.Open "select storeid, store_name from store", con, adOpenForwardOnly, adLockOptimistic    Do Until (rs.EOF)    Combo1.AddItem rs!store_name    Combo1.ItemData(Combo1.NewIndex) = rs!storeid            rs.MoveNextLoop

but how could i select one of those items using it's ID? so say one of the records has an ID of 100, do something like this:

VB Code:
Combo1.ListIndex = 100


How Select An Item In Listview Via Code ?
How ? Give me an example, please !

Does Anyone Know The Code To Get The Directory Select Dialogue?
Hi, i need to use the Directory select dialogue thats built into windows. Im not sure if the Common Dialogue 6.0 control has it, cause im using 5 and its not there ( ). Thanks.

Select ListView Item Through Code
Say I had a listview that had Sorted=False. I want to select an item, make .Sorted=True, then make the same item that was originally selected, selected again and scroll the listview so that the item is easily visible. Now, the question: how would I do that?

How Do I Add Code To A Select Case Statement?
I want to add text1.text to the following Select Case Statement:

Select Case cboApt.List(cboApt.ListIndex)

 Case "AMS": Aptelev = -12
 Case "HUY": Aptelev = 120
 Case "LCY": Aptelev = 16
 Case "MME": Aptelev = 116
 Case "NWI": Aptelev = 60

 End Select

and the I want to add aptelev.text to the end of that statement which is the figure bit.

How do i code it?

help much appreciated!


Select Video Compressor By Code
I'm developing a video cam capture aplication. By using Windows Video API, i aready can capture the video. The trouble is that the recorded video file is too large. (A 30min avi movie, has about 70MB!). I used a SENDMESSAGEA function to display a video compressor option where the user can select a codec. So the same avi video file has about 300kb usinG MPEG4 compressor.
But need to select the video compressor drive without display any message. Somebody could help me?
Thank you    

If I Select A Row In FLex Grid By Code...
Scenario is: I have about 50-60 rows in a Flex Grid. Now by code, I want to select some row, lets say row number 30 and want to move the scroll bar such that row number 30 is displayed no matter before selecting it wasnt displayed.
Got my point?

Copyright 2005-08, All rights reserved