Open .csv File And Display All The Data Inside To Datagrid?
hi what i want to do is i open .csv file and display all the data inside that .csv file to datagrid and refresh the datagrid everytime that .csv file data inside modify?
the problem i face it now display it to datagrid and refresh it? open file it's ok for me.
thanx a lot.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Open File And Display Its Data On A Form
how do i go about displaying data stored in an external file onto a form?
for instance i would like to able to press a command button and then the form would open with the data displayed on it.
any tips?
Copy Data From Datagrid To Open Office Spreadsheet File
Hi,
i have developed 1 small program, which reads records from sql server and convert into XL. now i want convert into open office spread sheet (calc) file. the same code is working. is there any different code for it. if so plz give some sample..
regards,
Guru
How Do I Display All DATA Inside A Database.
I am using a Adodc Control in a Access Database.I want a Datagrid or something of a Sort that Will display all the date in die Database in a List,where i can Scroll down and Select a Record(Name+Adres+Tel ect)
It must be like this
NAME SURNAME TEL AGE
***** ******* *** *** 1
***** ******* *** *** 2
***** ******* *** *** 3
***** ******* *** *** 4
***** ******* *** *** 5
***** ******* *** *** 6
***** ******* *** *** 7
***** ******* *** *** 8
***** ******* *** *** 9
***** ******* *** *** 10
Please help your fellow Learner
How To Open The Contents Inside The File
i have to select and open the particular excel file. When i click "Open" then the values stored in the cells of excelsheet should be displayed.how to do this using vbcoding?urgent, please help me.
Datagrid Won't Display Data
Set con = New ADODB.Connection
con.ConnectionString = "File Name=" & mstrDatabasePath
'mstrdatabasepath = "C: est.udl"
con.Open
Set rst = New ADODB.Recordset
rst.Open txtSQLString.Text, con, adOpenStatic, adLockOptimistic, adCmdText
Set dbgoutput.DataSource = rst
It just stopped working all of a sudden, syntactically I didn't change anything. The weird thing is I can generate XML, delimited, and HTML based upon the SQL taken from the textbox.
Any idea what might cause this?
Allowing User To Open A File From Inside VB
Hi all,
I would like to write a VB application that among other things allows the user to load a file and do work on it. The file in question is a CSV, comma separated value file.
The csv is created by instruments, the application is on the computers connected via intranet. The user opens the file using the application and does the neccessary work.
I know how to open a set file. What I want to do is let the user open the particualr file the user selects (e.g. from a folder). Thus the name of the file is not set, the user must be able to browse files in the folder.
Do not need the exact code, just a direction in which to get started
Thanks in advance, N. Peter Evans
Display Fresh Data On Datagrid
Hello, I'm deleting (recordset.delete) certain rows shown through a datagrid control.When i click update (recordset.update), the datagrid doesn't show the updated record and it will load & show the updated record only when i unload and reload the form, or when the form is "reActivated". I'm trying to use "datagrid.rebind" command to refresh the datagrid,but nothing happens.I'll have to unload and load the form again to display fresh data on the datagrid, but i know there is a right way to do this.Can somebody please tell me how?
Datagrid And Extern Data Display
I've a datagrid and i want
to display Column 7 in a textbox
if row is changed
and if the textbox changes
i want to save it into the
datagrid
my datagrid is bound on a recordset
how could i do this?
Datagrid To Display Data From Two Tables
Hi,
I am trying to display data from two tables in the one datagrid using an ado data control. The first table is expenses and the second is rates and they are joined by rateid. The trouble is I wasnt to show expenses for just one employee..
Having major difficulty. Any help would be appreciated.
Display Data From Datagrid To Textbox
i want to know on how can i simply display the data in datagrid in the textbox.for example the user will click on one item in the datagrid and then all the data from the row will be displayed in each of the textbox that i've assign for each of the fields in the recordset.help me..tq
Datagrid Doesn't Display Data
Hi there,
I tried to use a datagrid control is to display some
records retrieved from a table but couldn't get it
done.
stmt = "Select itemName, quantityAvailable from
inventory"
set rs = new recordset
rs.open stmt, activeConn,........
datagrid1.dataSource = rs
with rs
if .RecordCount > 0 then
.movefirst
end if
............
In the debugging window, I could see that 16 records
were retrieved but datagrid1 didn't display any data.
Why? And can data be displayed? Anyone has any idea?
Please help.
Jeremy
Determining Data To Display In A DataGrid (VB6)
Hi guys,
i've now got a datagrid which i need to populate with records from a mdb table depending on what is selected in two combo boxes.
I have two combo boxes which display date from and date to and i need some code that puts records into the datagrid between the two dates selected in the combo boxes....so if anyone could help out , i'd be grately appreciative.
Datagrid Display Incorrect Data
I'm stock when my datagrid display only check boxes instead of texts in the datagrid cells. Below are my code that I use to populate the datagrid.
Code:Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:VB ProjectFormPracticeLoginScholarship.mdb"
Dim strPerSQL As String = "SELECT Personal.SSN, Personal.FstName, Personal.MdlName, Personal.LstName, Education.Status, Education.Rank FROM Personal, Education WHERE Personal.SSN=Education.SSN"
perDataAdapter = New OleDbDataAdapter(strPerSQL, strConn)
perDataSet.Clear()
perDataAdapter.Fill(perDataSet, "Personal")
Dim ts As New DataGridTableStyle()
dgApplicants.SetDataBinding(perDataSet, "Personal")
ts.MappingName = "Personal"
Dim dtColSSN As New DataGridBoolColumn()
dtColSSN.HeaderText = "SSN"
dtColSSN.MappingName = "SSN"
dtColSSN.ReadOnly = True
Dim dtColFstName As New DataGridBoolColumn()
dtColFstName.HeaderText = "First Name"
dtColFstName.MappingName = "FstName"
dtColFstName.ReadOnly = True
Dim dtColMdlName As New DataGridBoolColumn()
dtColMdlName.HeaderText = "Middle Name"
dtColMdlName.MappingName = "MdlName"
dtColMdlName.ReadOnly = True
Dim dtColLstName As New DataGridBoolColumn()
dtColLstName.HeaderText = "Last Name"
dtColLstName.MappingName = "LstName"
dtColLstName.ReadOnly = True
Dim dtColStatus As New DataGridBoolColumn()
dtColStatus.HeaderText = "Standing"
dtColStatus.MappingName = "Status"
dtColStatus.ReadOnly = True
Dim dtColRank As New DataGridBoolColumn()
dtColRank.HeaderText = "Rank"
dtColRank.MappingName = "Rank"
ts.GridColumnStyles.Add(dtColSSN)
ts.GridColumnStyles.Add(dtColFstName)
ts.GridColumnStyles.Add(dtColMdlName)
ts.GridColumnStyles.Add(dtColLstName)
ts.GridColumnStyles.Add(dtColStatus)
ts.GridColumnStyles.Add(dtColRank)
dgApplicants.TableStyles.Add(ts)
dgApplicants.DataSource = perDataSet.Tables!Personal
Please help.
Thanks!
Chong
Display DBF File Into DataGrid
Hi all
i am a complete novice in database programming in VB. I have a DBF file whose location and file name is always constant. I want to display it in a form using DataGrid control. I would appreciate it very much, if someone can point me to proper codes.
thanks a lot in advance
karin
How To Open/display A File
I want to open a file( Not for reading or writing). Just to display the specified text fiel on the screen. How do I go?
Display Retrieved Records From Text File On Datagrid
I have created the file as:
Code:
Open App.Path & "T1.Txt" For Append As #1
Print #1, s
Close #1
I am using the following code for retrieving values:
Code:
Open App.Path & "T1.Txt" For Input As #1
Do While Not EOF(1)
Line Input #1, s
Loop
Close #1
I want to store the data in a DataGrid. How to do so?
Display Retrieved Records From Text File On Datagrid
I have created the file as:
Code:
Open App.Path & "T1.Txt" For Append As #1
Print #1, s
Close #1
I am using the following code for retrieving values:
Code:
Open App.Path & "T1.Txt" For Input As #1
Do While Not EOF(1)
Line Input #1, s
Loop
Close #1
I want to store the data in a DataGrid. How to do so?
Open Notepad And Display Text Which Isn't In A File
How can I open notepad and display text which isn't in a file?
My prog processes an input file to create some output text.
I have a button
"open in notepad"
I want it to open notepad with the text but with no file name, as though a "new " had been selected from the File menu.
Thanks
Problem When Insert Data Into Datagrid, It Works Only If I Re-open The Form.
Hi,
I have frmStaff with StaffName, StaffNo, TNFCode, grdDataGrid and cmdEvaluate. This is the code,
Code:
Private Sub cmdEvaluate_Click()
.....
.....
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "INSERT INTO tblStaffCompetency (STAFF_NO,
COMPETENCY, [DESC], TNFCODE, JOBNEED) SELECT
[tblStaff].[STAFF_NO], [tblTNACompetency].
[COMPETENCY], [tblCompetency].[DESC],
[tblTNACompetency].[TNFCODE], [tblTNACompetency].
[JOBNEED] FROM tblCompetency INNER JOIN (tblStaff
INNER JOIN tblTNACompetency ON [tblStaff].
[TNFCODE]=[tblTNACompetency].[TNFCODE]) ON
[tblCompetency].[COMPETENCY]=[tblTNACompetency].
[COMPETENCY]", db, adOpenStatic, adLockOptimistic
Set grdDataGrid.DataSource = adoPrimaryRS
grdDataGrid.Enabled = True
grdDataGrid.AllowUpdate = True
grdDataGrid.AllowAddNew = True
grdDataGrid.Refresh
End Sub
Private Sub Form_Load()
.....
.....
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "SHAPE {select STAFFNAME,STAFF_NO,TNFCODE from
tblStaff} AS ParentCMD APPEND ({select
STAFF_NO,DESC,JOBNEED from tblStaffCompetency }
AS ChildCMD RELATE STAFF_NO TO STAFF_NO) AS
ChildCMD", db, adOpenStatic, adLockOptimistic
Dim oText As TextBox
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
Set grdDataGrid.DataSource = adoPrimaryRS("ChildCMD").UnderlyingValue
grdDataGrid.Enabled = False
mbDataChanged = False
End Sub
When i click on cmdEvaluate, grdDataGrid should load all the Desc and JobNeed that relevant to the staff. My problem is, after i click the button, nothing happen. It works only if i close and open again the form. Any idea? I already refresh the grdDataGrid but it doesn't work.
Thanx in advance..
Problem When Insert Data Into Datagrid, It Works Only If I Re-open The Form.
Hi,
I have frmStaff with StaffName, StaffNo, TNFCode, grdDataGrid and cmdEvaluate. This is the code,
Code:
Private Sub cmdEvaluate_Click()
.....
.....
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "INSERT INTO tblStaffCompetency (STAFF_NO,
COMPETENCY, [DESC], TNFCODE, JOBNEED) SELECT
[tblStaff].[STAFF_NO], [tblTNACompetency].
[COMPETENCY], [tblCompetency].[DESC],
[tblTNACompetency].[TNFCODE], [tblTNACompetency].
[JOBNEED] FROM tblCompetency INNER JOIN (tblStaff
INNER JOIN tblTNACompetency ON [tblStaff].
[TNFCODE]=[tblTNACompetency].[TNFCODE]) ON
[tblCompetency].[COMPETENCY]=[tblTNACompetency].
[COMPETENCY]", db, adOpenStatic, adLockOptimistic
Set grdDataGrid.DataSource = adoPrimaryRS
grdDataGrid.Enabled = True
grdDataGrid.AllowUpdate = True
grdDataGrid.AllowAddNew = True
grdDataGrid.Refresh
End Sub
Private Sub Form_Load()
.....
.....
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "SHAPE {select STAFFNAME,STAFF_NO,TNFCODE from
tblStaff} AS ParentCMD APPEND ({select
STAFF_NO,DESC,JOBNEED from tblStaffCompetency }
AS ChildCMD RELATE STAFF_NO TO STAFF_NO) AS
ChildCMD", db, adOpenStatic, adLockOptimistic
Dim oText As TextBox
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
Set grdDataGrid.DataSource = adoPrimaryRS("ChildCMD").UnderlyingValue
grdDataGrid.Enabled = False
mbDataChanged = False
End Sub
When i click on cmdEvaluate, grdDataGrid should load all the Desc and JobNeed that relevant to the staff. My problem is, after i click the button, nothing happen. It works only if i close and open again the form. Any idea? I already refresh the grdDataGrid but it doesn't work.
Thanx in advance..
Open Text File Into Datagrid - Not Hard Coded
Back in 2002 Zbigniew Borysiuk posted some code on VBCode.com that imported a text file into a datagrid using textstream (see Link to his source code ). This works rather well, but the location of the text file to be opened is 'hard coded' (strPath = App.Path & "Grid.txt" - see below). However, I want people to be able to select the location and file name to be opened. I tried using the commondialog "open" command but couldn't get that to work in the slightest and then I created a text box which lists the path and filename that the user selects (using the Drive1, Dir1, File1 method), but can't seem to find a way of using them with the code either. I'd be very grateful if anyone could point me in the right direction. I'm using VB6 and a text file as the import (I tried using a table in an access database but people then wouldn't be able to save the table as different names in different places on their hard drive - I'm making some stats software and will eventually need the columns in the grid to be summed, divide one column sum by another, etc etc).
Anyway, Here are the troublesome code snippets:
Private Sub Form_Load()
'create rs and bind grid to it
If CreateRs(OpenFile(conRead)) Then
Set DataGrid1.DataSource = rs
'count the records
NumRec
Else
MsgBox "Application cannot create a recordset."
End If
End Sub
Private Function OpenFile(X As String) As TextStream
Dim fso As New FileSystemObject
Dim fil As File
Dim ts As TextStream
Dim s As String
Dim strPath As String
Dim Location As String
'get a path
' this is the bit I need to correct - changing App.Path to anything else breaks the code
strPath = App.Path & "data.txt"
lblFile.Text = strPath
'open the file
Set fil = fso.GetFile(strPath)
Set ts = fil.OpenAsTextStream(X)
Set OpenFile = ts
End Function
Even a pointer on the web would be useful,
Many thanks,
Grant
I am logged in, therefore I am.
Pls HELP!!! Display Data From File To Picture Box
Hi there,
I'm trying to display data from file to picture box but I'm getting stuck with some points.
Here are my data.
"January","James","Food",5.5
"January","Andy","Travel",16.8
"February","Tony","Room",30.00
"February","Andy","Food",4.00
"March","Jerry","Food",6.5
"April","Jeff","Travel",122.8
"February","Lisa","Room",20.00
If I want to print data for February on picture box, it shows;
February
Room 30.00
Food 4.00
Room 20.00
but what I need to show is;
February
Room 30.00
Room 20.00
Sub Total $50.00
Food 4.00
Sub Total $4.00
Month Total $43.50
I need the program to group Room, Food and Travel and calculate total.
It also generates the same display format if I choose others month.
Here is my code;
Code:
' Select Data from file and print to picOutput
Private Sub cboSelect_Click()
Dim ExpMonth As String
Dim Name As String
Dim ExpType As String
Dim Amt As Single
picOutput.Cls
picOutput.Print "Budget Report"
Open "d:my documentsmy paperexpenses.txt" For Input As #1
picOutput.Print
picOutput.Print cboExpMonth
picOutput.Print
Do While Not EOF(1)
Input #1, ExpMonth, Name, ExpType, Amt
If cboSelect.Text = Name Or cboSelect.Text = ExpMonth Then
picOutput.Print Tab(25); ExpType; Tab(50); FormatCurrency(Amt)
End If
Loop
Close #1
End Sub
Private Sub cmdExpMonth_Click()
cboSelect.Clear
lblSelect = "Expense Month:"
picOutput.Cls
cboSelect.AddItem "January"
cboSelect.AddItem "February"
cboSelect.AddItem "March"
cboSelect.AddItem "April"
cboSelect.AddItem "May"
cboSelect.AddItem "June"
cboSelect.AddItem "July"
cboSelect.AddItem "August"
cboSelect.AddItem "September"
cboSelect.AddItem "October"
cboSelect.AddItem "November"
cboSelect.AddItem "December"
End Sub
'Select by name and print to picOutput
Private Sub cmdPerson_Click()
Dim ExpMonth As String
Dim Name As String
Dim ExpType As String
Dim Amt As Single
Dim i As Integer
Dim intDuplicate As Integer
picOutput.Cls
lblSelect = "Expense Person:"
cboSelect.Clear
Open "d:my documentsmy paperexpenses.txt" For Input As #1
Do While Not EOF(1)
intDuplicate = 0
Input #1, ExpMonth, Name, ExpType, Amt
For i = 0 To cboSelect.ListCount - 1
If Name = cboSelect.List(i) Then
intDuplicate = 1
Exit For
End If
Next i
If intDuplicate = 0 Then cboSelect.AddItem Name
Loop
Close #1
End Sub
Can anybody help me to fix my code?
It would be great if you could show my how to use array on this program.
Thank you very much for you help.
Cheers,
Andy
How To Display A List Of Files Inside A Dir?
Hi.
I want to display a list of files inside a directory example:
Folder:
2004------> 20 files....
2005------> 30 files
What object will i use,and how will i do this?
please...
How To Display Number Inside The Circle Using Vb6
Hi,
I need to put 250 small circle and I need to display their numbers inside that circle. I tried in shape control but there is no caption property. Please help me which control I should use to satisfy my needs.
Thanks in advance,
Vijaya.
Newbie - Read From A File And Display Data
I am employed in a small company called "Drive-Yourself vehicle hire" I was dumb enough to put forward this idea and being middle aged and a computer phobe it wasnt the brightest thing to do. The problem is we are planning to expand and want an analysis of what cars are hired most regularly over the
last two months and the best earners. We will have a sequential file (.txt) that contains details of vehicle hire and wish to have a programme that will read this file and analyse the data it contains.
I think an array with all our companies cars and prices would be in the code, yeah? Like below.
VEHICLE CODE COST PER HALF DAY
Daihatsu Vitara DV £5.00
Etc...
An example of how the sequential file is set out is below:
"DV(Vehicle code),#2001-06-25#(date),"h" (h for half, d for day)
The bracketed info isnt in the file
Can someone help me plz!!!!!
How To Display A Data Warehouse CUBE File In VB
Hi
i m doing a project on Data warehouse on bank using SQL and VB
i got the code of how to do a cube in VB by using ADO
but now i dont know how to display the values or explore the cube in VB
does there is any kind of grid Available in VB
PLz do Help
Thnks in Advance
Import Data From .txt File And Display It In Listview
Hi,
I have some problems here, I want to import data from .txt file and then display it in listview. But now I've meet problems that the data is read but it did not display in the listview.
Below is how the program functions:
Private Sub btnImport_Click()
OpenDB
'establish connection to database
Dim dcnRefund As New ADODB.Connection
dcnRefund.CursorLocation = adUseClient
dcnRefund.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source = '" & gdcnRefund & "'"
Set rstImport = New ADODB.Recordset
Dim item As ListItem
Dim iFile As Integer, sData() As String, strLine As String
Dim sVar As Variant
Dim strVar As String
Dim i As String
Dim flag As String
Dim strflag As String
Dim strflagend As String
Dim importsql As String
i = 0
flag = 0
iFile = FreeFile
If txtFileName.Text = "" Then
MsgBox ("Please enter file")
Refresh_Data
Else
Open txtFileName For Input Access Read Lock Read Write As #iFile
Refresh_Data
' Loop through each line, looking for the key
Do Until EOF(iFile)
i = i + 1
StatusBar1.SimpleText = "Line " & i & " of textfile"
Line Input #iFile, strLine
strflag = Mid(strLine, 1, 11)
If strflag = "*** REFUNDS" Then
flag = 1
End If
strflagend = Mid(strLine, 1, 17)
If strflagend = "*** REFUNDS Total" Then
flag = 0
End If
If strLine <> "" And flag = 1 Then
'to get ticket number from character 1 to 10
sVar = Mid(strLine, 5, 4) & Mid(strLine, 10, 3) & Mid(strLine, 14, 3) 'Mid(strLine, 1, 4) means from character 1 of the text file move 4 spaces right.
strVar = sVar
OpenDB
importsql = "SELECT * , tblRefund.RefundID AS RefundID FROM tblRefund INNER JOIN tblRefundCal ON tblRefund.RefundID=tblRefundCal.RefundID WHERE tblRefund.TicketNo LIKE '" & strVar & "' And tblRefund.Status = 'REFSUBM'"
Set rstImport = New ADODB.Recordset
rstImport.Open importsql, dcnRefund, adOpenStatic, adLockOptimistic
If (rstImport.EOF = False) Then
rstImport.MoveFirst
Set item = lstBSPBillingImport.ListItems.Add(, , rstImport!RefundID)
item.SubItems(1) = rstImport!CreatedDate & ""
item.SubItems(2) = rstImport!PaxName & ""
item.SubItems(3) = rstImport!TicketNo & ""
item.SubItems(4) = rstImport!NettRefundAmt & ""
item.SubItems(5) = rstImport!RefundID & ""
rstImport.MoveNext
End If
rstImport.Close
End If
Loop
For Each item In lstBSPBillingImport.ListItems
item.Checked = True
Next item
End If
Close #iFile
End Sub
Private Sub btnUpdate_Click()
Dim RefundIDsql As String
Dim RefundLogsql As String
Dim item6 As ListItem
OpenDB
'establish connection to database
Dim dcnRefund As New ADODB.Connection
dcnRefund.CursorLocation = adUseClient
dcnRefund.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source = '" & gdcnRefund & "'"
For Each item6 In lstBSPBillingImport.ListItems
If item6.Checked = True Then
gintRefundDocID = item6.ListSubItems.item(5)
RefundIDsql = "SELECT * FROM tblRefund WHERE RefundID= '" & gintRefundDocID & "'"
RefundLogsql = "SELECT * FROM tblLog"
Set rstupdateId = New ADODB.Recordset
rstupdateId.Open RefundIDsql, dcnRefund, adOpenStatic, adLockOptimistic
Set rstRefundLog = New ADODB.Recordset
rstRefundLog.Open RefundLogsql, dcnRefund, adOpenStatic, adLockOptimistic
rstupdateId!Status = UCase("BSPACK")
rstupdateId!ModifiedBy = UCase(gintLoginID)
rstupdateId!ModifiedDate = Format$(VBA.Date, "mm/dd/yyyy")
rstupdateId.Update
rstRefundLog.AddNew
rstRefundLog!RefundID = gintRefundDocID
rstRefundLog!Status = UCase("BSPACK")
rstRefundLog!ModifiedDate = Format$(VBA.Date, "mm/dd/yyyy")
rstRefundLog!ModifiedBy = UCase(gintLoginID)
rstRefundLog.Update
End If
Next item6
MsgBox ("Update Successful!")
Refresh_Data
End Sub
Private Sub Form_Load()
Refresh_Data
End Sub
Private Sub Refresh_Data()
txtFileName.Text = ""
lstBSPBillingImport.ListItems.Clear
End Sub
***When I click on the "Import" button these procedures will carry on.
It supposed to display the data retrieved from .txt file into the listview interface but it did not display. Can anyone troubleshoot for me please?
Thank you.
Click Datagrid Row And Display Details To Another Datagrid
hello there..here i need help. i have a datagrid that retrieve data from database.what i want to do with the datagrid is when i click any rows of the datagrid it can display the details of the data (refer to the row that i click) to another datagrid.
is there possible to be done ?
i want to know if there is any procedure that can capture the datagrid row that i clicked
Displaying Text File Content In A Datagrid Then Open That Text File...
I have a form named frmTest and contains a datagrid called dgData and two buttons. One is button 'Read text file' and the other one is 'open text file'. I also have a class module named CReadFile. and a textfile named test.txt
The code for button Read text file is:
Code:
Private Sub cmdReadTXT_Click()
Dim obj As CReadFile
Set obj = New CReadFile
Set dgData.DataSource = obj.Read_Text_File
Set obj = Nothing
End Sub
and the code for the open text file button is:
Code:
Open "test.txt" For Input As 1
MsgBox "file opened."
Close
The code inside the class module is:
Code:
Option Explicit
Public Function Read_Text_File() As ADODB.Recordset
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)};" & _
"DBQ=" & App.Path & ";", "", ""
rs.Open "select * from [test#txt]", conn, adOpenStatic, _
adLockReadOnly, adCmdText
Set Read_Text_File = rs
Set rs = Nothing
Set conn = Nothing
End Function
_____________
This is what happens, if you click the button 'Read text file', the contents of the text file will be displayed in the data grid. After clicking the button 'Read text file', I now want to click the button 'Open text file' to open the text file, but an error appears saying: Run time error '70': Permission Denied.
Why is that so? What should I do to solve this problem? I need to open that file again for validation after displaying the contents.
Thank you.
Data File To Datagrid?
I was wondering if its possible to populate a datagrid from data file (comma seperated value) and in turn send the data in the datagrid to an Oracle database. The purpose of the datagrid is to let the user edit the data coming from the data file before uploading to the Oracle database.
Thank you in advance.
Data File To Datagrid?
I was wondering if its possible to populate a datagrid from data file (comma seperated value) and in turn send the data in the datagrid to an Oracle database. The purpose of the datagrid is to let the user edit the data coming from the data file before uploading to the Oracle database.
Thank you in advance.
How To Display Checkbox Inside Cell Of A Mshflexgrid
Good day to all!, gotta ask how could i display checkbox inside cell of mshflexgrid, you know i want the user to check certain rows of mshflexgrid and then i will proceed with printing of those rows that were checked. Please help me.
Create A Graph To Display Data From A Text File
Hiya all,
I'm very new to vb and have already come across a number of problems. I have a text file with lots of data and need to graph it in vb. Whats the easiest way to do this? I've tried Mschart but i'm finding it difficult to get any help on this. Would it be easier to import the file to excel and work from there???
Any help would be greatly appreciated. Thanx
Retrieve Data From A Text File And Display In A Textbox.
Hi! I hope someone could help me with this.
I want to retrieve data saved in .pnp file and display it in the same txtboxes and same order as it was saved.
My current code is:
VB Code:
(globalvar.bas)Option Explicit Public pn1 As New partnamelist (frm_field)Private Sub fieldupload() With pn1 'I made a class named partnamelist having these 4 properties: part, description, quantity, and version .part = txt_part.text .description = txt_desc.Text .quantity = txt_qty.Text .version = txt_version.Text End WithEnd Sub Private Sub cmd_apply_Click()dim filename as string If Len(txt_part.text) = 0 And _ Len(txt_desc.Text) = 0 And _ Len(txt_qty.Text) = 0 And _ Len(txt_version.Text) = 0 Then MsgBox "please enter the necessary values." txt_part.setfocus Else fieldupload filename = txt_filename.text 'Specified filename of the user MsgBox ("Creating profile... Please choose what directory to save your profile.") frm_dir.Show vbModal End IfEnd Sub '(frm_dir) Private Sub Form_Load() txt_pnprofile.Text = frm_field.filename + ".pnp" '--> "pnp" here in my example is my chosen extension.End Sub Private Sub cmd_ok_Click() txt_profilepath.Text = file1.Path & file1.FileName & "" & txt_plprofile.Text 'file1 is a file listbox btw MsgBox "Saving " & txt_profilepath & " as new profile." SaveProfile txt_profilepath.Text, pn1 profilepath = txt_profilepath.TextEnd Sub Private Sub SaveProfile(WhatFile As String, TheProfile As namelist)Dim FreeFileHandle As Integer FreeFileHandle = FreeFile Open WhatFile For Output As FreeFileHandle With TheProfile Print #FreeFileHandle, "[Part] " & .part Print #FreeFileHandle, "[Description] " & .description Print #FreeFileHandle, "[Quantity] " & .quantity Print #FreeFileHandle, "[Version] " & .version End With Close FreeFileHandleEnd Sub
Output of egfile.pnp:
[Description] b42
[MakerCode] c65
[PartnameCode] x32
[Quantity] x75
[SymbolicCode] q21
After clicking RETRIEVE button, I want that b42 will be displayed in txt_description.text and so on and so forth.
How do I do this? I don't know how to use Line Input # Statement as well.
Anybody, pls. help.
How To Display The Content Of Text File In The Data Report?
Hey dude,
I want to to show the content of the text file in the data report. Can you please let me know that how can show the text file stuff in the data report.
code snippets will be prefered.
Thanks I am eagerly waiting for your reply.
please. help me.
Thanks
Kamlesh Gujarathi
kamlesh@itshastra.com
Fly always to the SKY. You can do anything if you TRY. ;)
ComboBox Inside A DATAGRID
hi,
I've tried to add a combobox to the datagrid, however, when buttonclick event is activiated, only the dropdown icon is shown, without the combobox list values. I've already additems to the combobox on Form_load.
Why is that? Anything missing?
Thanks
Meeko
ComboBox Inside A DATAGRID
hi!
please help me embed a combobox in a datagrid
there is a property in datagrid indicating button
i have clicked that and a dropdown is created
but how can i fill that combobox inside the datagrid?
tenks for the help =)
|