Link to home
Start Free TrialLog in
Avatar of Justin Malone
Justin Malone

asked on

vb6 copy & paste table

i have a web interface that displays information in the form of a table. i also have a database program that will store the information. i would like to be able to copy a single row of the table and paste it into my vb program

worded diffrently

i would like to copy a table from a web interface to a vb program and maintain the breaks so i can assign each cell to a different variable. because its too complex to try to use string manipulation
Avatar of Justin Malone
Justin Malone

ASKER

im trying to use the
Clipboard.GetText
command im just not sure how to use it. i can copy the web table to the clipboard and use that command to bring it into the program. it looks like it is seperats each field by tabs so if i could insert some type of table in my program and i should be able to use the Clipboard.GetText to insert the information then define each cell as a var im just not sure how to put a table in VB
using ado object would be the best thing to use else, it would be a mess
u just need to loop thru the table structure and data with the help of array or ado object


>>im trying to use the
Clipboard.GetText
command im just not sure how to use it

is it just


dim s as string

s = Clipboard.GetText
im just not being clear with what i am trying to do here. you know how if you copy a table and then past it in an excell sheet it automaticly puts everything in the correct cell? i would like to do something like that. i need to be able to copy a table that is 1 row and about 10 coloms and then paste once and fill in 10 variables
I think that is something you have to build yourself because this is not MS Excel, MS Word or etc. You could just copy and paste it in notepad then figure out how the information is separated by columns and rows and discard any other information (I bet it’s in html format). Then you can setup a routine in VB that will sort out the raw data and you can place it in the proper columns. Use notepad to figure out the tag codes because any other advance program may hide certain tag codes that you need to see.


thats what i figured so i wrote a function to do some string manipulation (some variables arent defined in this code but it does work)

Option Explicit 'updated

'script requires input in the form of a string labled value and an arguement for bootest
'the function is designed to loop through a string and create a var for each letter for arguments
'result is the single char that it focus on. txtendresult is the string from the begining to the end
'also you can set start and stop delemenating chars if you know what they are. set
'boostrstart to true first then set starchar as the first char you want to record and
'endchar where you want to stop the result will be wrstring
'txtrightresult string from the right of the focus char

Private Sub Command1_Click()
filter
End Sub

Public Function filter() 'function to evaluate each piece of a string one char at a time.
Dim value As String
'==============================================================================
value = Me.txt1.Text '<<<<<<<INPUT>>>>>>>>>
'==============================================================================
'function vars
Dim txtstr As String
Dim startcount As Integer
Dim endcount As Integer
Dim leng As Integer
Dim bootest As Boolean
dim boostrstart as Boolean

'output vars
Dim result As String '<<<<<<<<<< Focus Char
Dim txtendresult As String ' <<< String to left of Focus Char
Dim txtrightresult as String '<< String to Right of Focus Char

'declerations
boostrstart = false
bootest = False
leng = Len(value)
endcount = 1

if boostrstart = True then
      strstart
end if



'function
Do Until bootest = True
txtstr = value
txtstr = Left(txtstr, endcount)
txtendresult = txtstr
txtstr = Right(txtstr, 1)

'results
result = txtstr
endcount = endcount + 1
If endcount = leng + 1 Then bootest = True
txtrightresult = Right(value, Len(value) - len(txtendresult)) <<< UNTESTED
'building string end result
MsgBox (txtendresult)


Loop
End Function

Public Function strstart()
dim wrstring as String
dim tpstring as string
dim starchar as string
dim endchar as string

if result = starchar then
     do until result = endchar
wrstring = wrstring & tpstring
     loop
end if
ASKER CERTIFIED SOLUTION
Avatar of iHadi
iHadi
Flag of Syrian Arab Republic image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i just used my set to break about the string witch works for now. and even though i havent used this code yet if it does what you say it does i likeley will use it once i get approval to have the program interface with the html. sorry for not closeing the q earlyer even though i had solved the problem  i was still looking for alternate methods for later.
and about the point assignment. i was going to cancel the question since nobody had actualy awnsered the question but since i will likeley be useing the code from iHadi  in whole or part i am awarding points.