473,407 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Combo box Not showing data after routine

vb.net 2003


I 'am running a routine.
A form opens up
Loads Files into combo box from a dir
I delete the file.
and then copy new files back into folder

This is the same code I'am using to load the combo box when the form opens.

Problem:
Combo box is not resetting correctly and showing me the new files I have copied
back into the folder...

' code============
Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
Dim ExcelFile As String
Dim FindFiles() As String = System.IO.Directory.GetFiles("C:\Dm2007\Inbox\", "*.xls") ' filter only excel files *.xls

RestartText()
' Run Access Macros for restart
AccRestart()
For Each ExcelFile In FindFiles
' cboFileLoad.Items.Add(ExcelFile) 'all the dir and file name
cboFileLoad.Items.Add(ExcelFile.Substring(ExcelFil e.LastIndexOf("\"c) + 1))
Next

cboFileLoad.Refresh()

MsgBox("Process Steps Reset", MsgBoxStyle.Information, "Reset Example Tables")

End Sub

Other Routines:
Private Sub AccRestart()

Dim oAccess As New Microsoft.Office.Interop.Access.Application
'Start Access and open the database.
oAccess = CreateObject("Access.Application")
oAccess.Visible = False
oAccess.OpenCurrentDatabase("C:\dm2007\ImpData.mdb ", False)
'Run the macros.
oAccess.Run("Reset1")
'Clean-up: Quit Access without saving changes to the database.
oAccess.Quit()
oAccess = Nothing
'============================
End Sub

Private Function RestartText()
' DELETE FILES First
' Do The Filing System stuff
System.IO.File.Copy("C:\Dm2007\TextFilesSamples\Or iginal\RemoveSpecialTest.txt", "C:\Dm2007\TextFilesSamples\RemoveSpecialTest.txt" , True)
System.IO.File.Copy("C:\Dm2007\TextFilesSamples\Or iginal\ReplaceTest.txt", "C:\Dm2007\TextFilesSamples\ReplaceTest.txt", True)
System.IO.File.Copy("C:\Dm2007\TextFilesSamples\Or iginal\StripVowels.txt", "C:\Dm2007\TextFilesSamples\StripVowels.txt", True)
System.IO.File.Copy("C:\Dm2007\TextFilesSamples\Or iginal\VendNameTest.txt", "C:\Dm2007\TextFilesSamples\VendNameTest.txt", True)
System.IO.File.Copy("C:\Dm2007\Original\SearchRepl aceTables.xls", "C:\Dm2007\Inbox\SearchReplaceTables.xls", True)


End Function


Thanks
fordraiders
Jan 6 '07 #1
3 1674
I am not exactly sure, but you have declard ExcelFile as a string, but it has no assigned value.

When you move to your "for each" statement ExcelFile is still empty.

rough example:

dim xlsFile as File or Object 'im not sure

for each xlsFile in system.io.directory.getfiles("blah","*xls")

combobox.items.add(xlsfile)

next xlsFile
Jan 7 '07 #2
Thanks
Wow! It worked..!
However, In the combobox I do not need to see the dir reference..
It shows:

c:\dm2007\inbox\<filename>.xls
I just need to see
<filename>.xls

Appreciate the help ! Very very much.!
Jan 7 '07 #3
Thanks
Wow! It worked..!
However, In the combobox I do not need to see the dir reference..
It shows:

c:\dm2007\inbox\<filename>.xls
I just need to see
<filename>.xls

Appreciate the help ! Very very much.!
you should be able to do this...

for each ...

combobox.items.add(System.IO.Path.GetFileName(xlsF ile))

next...
Jan 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query....
3
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender,...
2
by: Brian Henry | last post by:
Hi, I have a data grid that is set up like this Page items displayed = 10 EnableViewState = false (i dont want to send large amounts of data over the internet!) CustomPaging = false...
6
by: Brian Henry | last post by:
Here's an example of the code.. I have two combo boxes on screen that when one's selection is change the other's items will be updated to reflect the change (based on a relation) Private...
9
by: bill.jenner | last post by:
I have two related tables I wish to use in a grid. The second table has to drive the list of items apart of a combo box apart of one of the grids columns. Table 1 schema has columns ( . . . ....
4
by: Miguel | last post by:
I have an order entry database with two forms. One is for new orders the other is to update orders. The forms are identical except that one is strictly order entry. On both forms are three sets of...
3
by: =?Utf-8?B?Y2RtdW5veg==?= | last post by:
I have created a sub routine to programmatically add an indefinite number of combo boxes to a form. The combo boxes are bound in code to a view for displaying the available options. This routine...
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
1
by: pavanip | last post by:
Hi, I have a data grid control and I placed one combo box in that data grid and I am binding data to data grid combo box.When i run the application by default the combo box is not showing anything...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.