|
'how to select 1 file
'--------------------------
Private Sub CmdOpenFolderOneSelected_Click()
Dim i As Long, SelectedFilePath As String, SelectedFileName As String ', SelectedIndex As Index
Dim SearchStringSelect As String
For i = 1 To Listview1.ListItems.Count
If Listview1.ListItems(i).Selected = True Then
SelectedFileName = Listview1.ListItems(i).SubItems(1)
SelectedFilePath = Listview1.ListItems(i).SubItems(4)
If Right$(SelectedFilePath, 1) <> "\" Then SelectedFilePath = SelectedFilePath & "\"
If FileExists(SelectedFilePath & SelectedFileName) Then
SearchStringSelect = SelectedFilePath & SelectedFileName
Shell "explorer /select," & Chr(34) & SearchStringSelect & Chr(34), vbNormalFocus '& Chr(34) = focus to file
Else: MsgBox "file doesn't exists any more."
End If
End If
Next i
End Sub
'-------------------------------------------------------------------------------------------
This works to select 1 file in the windows explorer. Multiple doesn't work. Why? I m almost gived up. Butt i have energy back. Windows medea player can do it. So why not me? I try arrays, create object=windows explorer= not info found,...
'-------------------------------------------------------------------------------------------
|
|
|
|
|
Is there a reason not to use the common dialog control? The common dialog control has a property, that allows multiple files be selected. Regards: Didi
|
|
|
|
|
yes. It's an archive program and it filters items from the dir into a listview. I had that code already but not useful now.
FYI= all file are in 1 directory
modified on Sunday, June 7, 2009 4:20 PM
|
|
|
|
|
I don't understand, there are ways to fill a Listview with files of a directory programmaticaly, there is a vb6 control that allows you to watch folders directly etc. Why would you want to shell to explorer?
Regards: Didi
|
|
|
|
|
Aaa. Maybe i get you right now. I don't have to display that or someting like that.
Please give me some example code. so i understand you better.
I do this...
- I FILTER items for my disk in an listview
- select them in the listview to open an folder and select all filter items . (multie select in explorer)
It's like windows media player. select a song in the mediabibiotheek and "open the containing folder". all select files are selected in explorer
modified on Sunday, June 7, 2009 4:57 PM
|
|
|
|
|
I won't give you sample code, because I don't have. Read the documentation or search codeproject or google.
Regards: Didi
|
|
|
|
|
I need some good words to search for because i have try evrything.
|
|
|
|
|
Start here[^] and reconsider to use VB.NET. When I heard that right, it's your first steps with VB (exept VBA). I would not start to learn a old technology, when I start to lkearn something new. Get a good book on VB.NET and start using it. You will love it, when you get used to it a bit.
Regards: Didi
|
|
|
|
|
I can't believe there are still people using VB6.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Yes, so can't I! But if they want, let them do it. I only use it for supporting my old projects. Tried to upgrade one with the wizzard... forget it...
Regards: Didi
|
|
|
|
|
3reasons
- I am just a cad designer. Not full time programmer.
- office and vba ~= vb6
- It's posible.
A veteran will know it.
Maybe something else "create object": windows explorer and select items
|
|
|
|
|
2DaveMoon wrote: I am just a cad designer. Not full time programmer.
So, why make things hard for yourself ? VB.NET is better supported, better designed, and just better.
2DaveMoon wrote: office and vba ~= vb6
I thought new versions of Office also use .NET ?
2DaveMoon wrote: It's posible.
Programming in pure C is possible ( and more laudible than VB6 ), doesn't mean I'd do it.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Christian Graus wrote: I thought new versions of Office also use .NET ?
That's only partially true. The object support is better, but it's still VBA under the hood, sadly.
|
|
|
|
|
2DaveMoon wrote: A veteran will know it
A veteran will have forgotten it - we all moved on 8-9 YEARS ago.
You are still making your life difficult by using VB6, you will get better support by going to VB.Net
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
2DaveMoon wrote: A veteran will know it.
Oh yeah?? This verteran forgot VB6 8 years ago.
I've read through this entire thread and can't figure out what you're doing with an Explorer window or why.
|
|
|
|
|
VB Programmer- novice
I would like user to enter data into 3 columns in datagridview. The object of the excercise is to add values entered by user into a dataset which further will be added to a database table after more processing of data.
The data sample is as follows:
1. account code- a combo box - values to be populated from accounts table( acct code, acct desc)
2. Entry narration- text entered by user
3. amount - amount for the transaction
I was able to populate datagridview with 1st record with combobox, text field and amount field. But do not know how to replicate combobox to next line. Can somebody provide me a sample code in vb2005 to do the same.
BM17
|
|
|
|
|
Wait. It sounds like you're putting a ComboBox control into the DataGridView yourself??
|
|
|
|
|
Yes, I want to control datagridview.as dataset with get populated from datagrid values.The combobox will get values from another database table.
|
|
|
|
|
That made no sense at all.
Normally, you would use a form, or some textbox's, ComboBox's, or other controls on a seperate area of the form to get data to use in the search for records, populating the DataGridView with the results. You wouldn't normally use a DataGridView to get the parameters of the search.
|
|
|
|
|
I need help to create a text box that accepts only numbers and full stop in VB.Net. It was easy in vb6 but in VB.Net I am really confused. Can someone help me please,
Thank you.
|
|
|
|
|
You need to handle the KeyPress Event[^] like you did with vb6. Reagrds: Didi
|
|
|
|
|
How about using NumericUpDown control?
(I guess you are allowing '.' for user to enter decimal numbers.)
जय हिंद
|
|
|
|
|
Private Sub txt1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt1.KeyPress
Try
If Not (Char.IsNumber(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then e.Handled = True
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thank you very much Johan, Actually i wanted the box along with dots inbetween the numbers and I added IsPunctuation to your code. Thank you once again.
Didi, I was trying to do it as in vb6 but it was driving me mad without an answer. Ofcourse I am a beginer in VB.Net and Johan's coding is very new to me.
Danish, thanks for your reply but I needed a box with numeric values and with / without decimals to be keyed in.
Thank you all.
|
|
|
|
|
If you are used to VB6, you'll find .NET a bit confusing in the beginning, because its approach is just a little different, however just like in the example code I showed you, check out all the new properties and methods. Lots of things have become much easier to do, and I am quite sure you'll come to love it in about two weeks time, and wonder how you managed to do it all with vb6.
My advice is free, and you may get what you paid for.
|
|
|
|