codeorder 197 Nearly a Posting Virtuoso
codeorder 197 Nearly a Posting Virtuoso
jingda commented: ;) +9
jingda commented: And you did have it your way +0
:)
(rabbit penguins? I want one! :D)
With rabbit ears for feet and tail.
Easter eggs with penguins in them.
(saw that Mr. Popper's Penguins (2011) movie, liked it)
See if this helps.
Dim arTemp() As String = Nothing '// Array to .Split each TextBox line.
For Each txtLine As String In TextBox1.Lines '// loop thru all lines.
arTemp = txtLine.Split("|"c) '// .Split line.
For Each itm As String In arTemp '// loop thru arrays of current line.
MsgBox(itm) '// display results.
Next
Next
>>(trying to make an For Next function)
A For/Next is just a "loop", unless you meant to have a Function w/a For/Next loop in it.
Dim arTemp() As String = "tree_ptr->sub.another->valu=3;".Replace("->", "~").Split("~"c)
MsgBox(arTemp.Length - 1)
Thanks for the info. :)
See if this helps.
File Menu/Project/"your app's name" Properties.../Application tab.
.Set "Startup form:" to your Form, not Form1.
>>When the File dialog box opens, I select the 3 files and click on Open and nothing happens.
Works here just fine. Try in a new project if not new project already, otherwise, good luck.
See if this helps.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim myCoolOpenFileDialog As New OpenFileDialog
With myCoolOpenFileDialog
.Title = "Hold CTRL key while selecting a file to select multiple files at once..."
.Filter = "CSV Files (.csv)|*.csv"
.Multiselect = True
If .ShowDialog = DialogResult.OK Then
For Each selectedFile As String In .FileNames
loadCSVfileToTable(IO.Path.GetFileName(selectedFile)) '// send only the FileName and .Extension to your load CSV Sub.
Next
End If
End With
End Sub
Private Sub loadCSVfileToTable(ByVal myCoolFile As String)
Select Case myCoolFile.ToLower '// .ToLower in case the FileName and .Extension might be upper or lower case.
Case "1.csv" '// FileName set to LowerCase here.
MsgBox("loading file 1.csv into table 1") '// add code here to load the file into selected table.
Case "2.csv"
MsgBox("loading file 2.csv into table 2") '// add code here to load the file into selected table.
Case "3.csv"
MsgBox("loading file 3.csv into table 3") '// add code here to load the file into selected table.
End Select
End Sub
You could use another Parameter in the load CSV Sub for your Table and specify which table to load into to.
Something as:
Private Sub loadCSVfileToTable(ByVal myCoolFile As String, ByVal myCoolTableToUse As DataTable)
..and this in your OpenFileDialog.
For Each selectedFile As String In .FileNames
Select Case IO.Path.GetFileName(selectedFile).ToLower '// .ToLower in case the FileName and .Extension might be upper or lower case.
Case "1.csv" '// FileName set to LowerCase here.
loadCSVfileToTable(selectedFile, table1)
Case "2.csv"
loadCSVfileToTable(selectedFile, table2)
Case "3.csv"
loadCSVfileToTable(selectedFile, table3) …
>>With the code being a multi select how is possible to import into multiple tables, are there any demo ways of it being done?
How do you plan to select which table to load from what file?
.By file name?
.By file content?
If any of those 2 options, in the For/Next loop that displays the MsgBox, instead of displaying the fullPath of the file, load it in each table as needed.
chris007, next time start your own thread and add the link for this thread in it, if referring to it.
Otherwise, see if this helps to get all files in a folder.
Dim myCoolFolder As String = "C:\!vbTemp\" '// your folder.
For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
(myCoolFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
ListBox1.Items.Add(IO.Path.GetFileName(myCoolFile)) '// add file name with extension.
Next
'// to search subfolders, change "SearchTopLevelOnly" to "SearchAllSubDirectories".
'// to only get a certain file type, change "*.*" to your file type.
'//-- example for .txt files: "*.txt"
You can try this:
Private Sub ListView1_ItemSelectionChanged(sender As Object, e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged
With ListView1
If .Items(.Items.Count - 1).Selected Then .Items(.Items.Count - 1).Selected = False '// unselect last item if .Selected.
If Not .Focused Then .Focus() '// set focus to ListView if not .Focused.
End With
End Sub
...or, when getting values of selected items, you could just check if it is the last item and skip it.
Since using an Index, the count starts at 0 not 1 and using .Count
will count the items from 1 to whatever.
.The -2 will select all items from 0 to -2, which is selecting all items except the last item; last item being .Count - 1
.
-3 will select all items except the last 2 and so on.
EDIT::
I would use:
For i As Integer = 0 To ListView2.Items.Count.ToString - 2
and would declare the Integer all at once. Easier to declare and less typing. :)
Line 23, change For i = 0 To ListView2.Items.Count.ToString - 1
to For i = 0 To ListView2.Items.Count.ToString [B]- 2[/B]
Captnjj, please read the few rules and guidelines for this thread.
I guess I'll start this thread again, since the lord of the undeads killed himself and all the undeads died. :D
Near a pond, there is water.
For undeads need a lord as leader.
Can you post a sample of code from your C program, that includes comment lines?
This has never given me any issues with "The process cannot access the file '...' because it is being used by other program.".
Dim myFile As String = "C:\test.txt"
IO.File.WriteAllText(myFile, "text to save here")
Do let us know if you still have this issue after reinstalling. Good for references. :)
I agree with sandeepparekh9 . Try reinstalling your operating system.
This should not be an issue, especially since you have 3 different browsers installed.
If you just need to get the "n" value, see if this helps.
Dim iSelectedN As Integer = 0 '// stores the "n" value for use.
For n As Integer = 1 To 24
iSelectedN = n '// set value from loop.
With Form2.PictureBoxn
Select Case f1data(n).countries
Case "GER"
.Image = New System.Drawing.Bitmap("\bin\flags\de.gif")
Exit For '// Exit the For/Next loop since done.
Case "AUS"
.Image = New System.Drawing.Bitmap("\bin\flags\au.gif")
Exit For '// Exit the For/Next loop since done.
Case "GBR"
.Image = New System.Drawing.Bitmap("\bin\flags\gb.gif")
Exit For '// Exit the For/Next loop since done.
'// etc...
End Select
End With
Next
MsgBox("n = " & iSelectedN.ToString)
1. Use a OpenFileDialog with .MultiSelect=True
.
Dim myCoolOpenFileDialog As New OpenFileDialog
With myCoolOpenFileDialog
.Title = "Hold CTRL key while selecting a file to select multiple files at once..."
.Filter = "CSV Files (.csv)|*.csv"
.Multiselect = True
If .ShowDialog = DialogResult.OK Then
For Each selectedFile As String In .FileNames
MsgBox(selectedFile) '// get FullPath of each file.
Next
End If
End With
2. If there is no need for it to be loaded in a Form, then there is no need.
3. Not my specialty, good luck. :)
Hope this helps.
See if this helps.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.ShowInTaskbar = False
Form2.ShowInTaskbar = True
Form3.ShowInTaskbar = False
End Sub
The "ShowInTaskbar" can also be located in each Form's Properties.
See if this helps.
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.IsMdiContainer = True
Dim mdiForm As New Form
mdiForm.MdiParent = Me
'///////////////////
mdiForm.WindowState = FormWindowState.Maximized '// Maximize the MDI Form.
'///////////////////
mdiForm.Show()
End Sub
End Class
In the _DocumentCompleted
, after you set the values to a page, THEN... IN THAT SAME EVENT, load the next page as the last line of code until the last url has been used.
(Blackiey, one word too many. If I were a math teacher, I'd hold you back a grade just for that. :D, joke)
The devil is not a living being.
Wish I could be of further help, but I am completely confused on your issue.
.Good luck.
To be bold, you must live on the edge.
Shave
..., for Christ is in our hearts.
...
I would load your file into an ArrayList, send the first item(url path from file) to the WebBrowser, let it load, set values, and THEN move on to the next item in the ArrayList until the last item has been loaded.
...
Use the _DocumentCompleted
event for your WebBrowser, to give it time to load the page and set values, then at the end of that Sub/Event, move on to the next item/url in your list.
In a recent project, I previously had to check if a value was set in a WebBrowser's TextBox/Textarea, before moving on to loading the next page.
See if this helps.
'// Clear all SelectedCells.
For Each cell As DataGridViewCell In DataGridView1.SelectedCells : cell.Value = Nothing : Next
... and we will sacrifice another lamb together.
abelLazm and Portgas D. Ace got banned, reasons unknown, although great community members from what I know.
Uncertain
"I think that I fooled everyone here thinking that I'm holding a trash bag, but I am actually holding Betty Rubble's hair."
See if this helps.
Dim dt As New DataTable
With dt '// FOR TESTING. 2 Columns with 2 Rows.
With .Columns : .Add("1") : .Add("2") : End With
With .Rows : .Add("a" & vbCrLf & "1", "b" & vbCrLf & "1") : .Add("a2" & vbCrLf & "1", "b2" & vbCrLf & "1") : End With
End With
'// loop thru DataTable.
For Each row As DataRow In dt.Rows '// loop thru Rows.
For Each column As DataColumn In dt.Columns '// loop thru each Column in Row.
MsgBox("Before .Replace:" & vbNewLine & row(column).ToString) '// FOR TESTING.
row(column) = row(column).ToString.Replace(vbCrLf, " ") '// replace vbCrLf with " " in each column, for each row.
MsgBox("After .Replace:" & vbNewLine & row(column).ToString) '// FOR TESTING.
Next
Next
Cannot state what is unknown.
If possible, post your collections code and how you get a certain object/value from it.
Also, if the collection loads from a file, post some of the file content as well.
.Should be easy to try and provide a solution then, hopefully.
... and death will die soon after.
Your state of mind is all over the place man.
Country
Would I have to live in the country to listen to country music?
Death is just a part of life.
lambent
If lambent contained another "a" instead of an "e", we would have ourselves the tiniest lamb ever, a "lamb" "ant". :D
(had to get the thread back on track)
Health
Have you tried a For/Next loop, to loop through all fields in the collection and replace data in each field if needed?
For God would not exist without life.
I can do as I please; even if it leads to breaking a vase or two, I will get my way!!!:D
Shatter
And even ends eternal life with time.
Without some sort of obedience we picked up throughout our lives, we might act like cavemen when having to reply to threads, and club ourselves to death instead of just posting.
Disobedience