|
You use the index value to select the appropriate table. But a much easier method would be a ListBox with the table names, so the user could select the name, and you then have the exact value necessary.
|
|
|
|
|
Yes, I was trying to use an varible to "control" a pointer (which I haven't figured out how to create yet) much like the Index value you described but I can't seem to come up with anything with the previous code. I'm kinda stumped.
A listbox sounds like a good idea, but how do I display the individual tables within the Listbox? Do you have an example I could use for this?
|
|
|
|
|
I am not sure exactly what you are trying to do. Are you trying to display the content of the tables, or just their names? If the former then there are plenty of articles that explain how to bind between different view types and a database. If the latter then you just need to get the names from the database and add them one by one to the listview, or use simple databinding.
|
|
|
|
|
What I'm trying to do is build a simple utility that inputs data from a sporting event into individual tables within a database. Each table represents a sporting event with recorded stats. I have linked the database to the utility porperly with the code I listed before, but I can't seem to figure out how to build a pointer to input the data from each game into a particular table. Switching from table to table in the database is inportant in this utility, but I just can't figure out how to control the pointer in the database with a simple command button and a textbox to display the selected table.
any info would be most appreciated.
|
|
|
|
|
What you describe indicates a terrible database design - changing tables for different events/sports is a disaster (which you are finding)
Take a look at this database design[^] and consider starting from scratch with a better data structure.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Terrible Database Design? Whats wrong changing from one table to another?
|
|
|
|
|
Did you look at the design patterns in the link?
What happens when you have a new event/sport, you have to build another table, add code to service the table, EVERY time there is a new requirement.
If you designed your database properly you would have a EventType table with a foreign key to an event table. To add a new event you would create a new RECORD in the EventType table. The user can do this and you don't need to create a new table.
Look at the templates and read up on database design, you cannot become a LOB developer without a reasonable knowledge of database design.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
D. Doulas wrote: Visual Basic 6/Net
VB6 and VB.NET are two completely different languages. They share some similarities in syntax, but for the most part, code for one will not work in the other.
You need to decide which one you're using before asking for help with your code. Unless you're maintaining a legacy VB6 application, I'd strongly recommend picking .NET, since VB6 has been dead for over 15 years now.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I see. Thanks for the tip. I have VB.net, but I'm still learning the "In's-n-out's" of VB6. But I may try VB.net sometime.
|
|
|
|
|
Don't bother with VB6. You're going to have unlearn stuff to apply the same concepts in VB.NET.
|
|
|
|
|
D. Doulas wrote: I'm still learning the "In's-n-out's" of VB6
STOP you are completely wasting your time, not only that but you will learn the WRONG thing. Delete VB6 from your system and concentrate on VB.Net.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
D. Doulas wrote: I'm still learning the "In's-n-out's" of VB6 No developer writes code in VB6 for any client, paid or unpaid, because it is a dead and unsupported language, and the compiler isn't for sale anymore. If it was, there wouldn't be an OS that still supports the compiler.
From an ethical point, one cannot support VB6 code in any other way than a rewrite.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi guys,
I would like to know how to Read Multiple text file from a folder and count specific words from those text files ( using a button command )
Example:
Read DM01 ( not only DM01 , Sm05 too ) from all text files in a specific folder and output to a textbox in my program ( and add an exception which will count even if it lowercased or uppercased )
Example of text file: ( if ur wondering the DM01 and SM05 is always on the same line of each text document in the folder )
Im using visual studio 2017
https:
Need only the count value on the textbox like
Example : 2 ( is the count value output it to textbox )
Please note that the files format cannot be changed to any other format other than .txt)
|
|
|
|
|
So, a button-click, then loop through some text-files, and count the words in the string that you read said textfile to?
What part are you stuck? What have you tried?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Well im stuck on how to start this is all i got so far
Dim path As String = "D:\Logs"
TextBox3.Text = IO.Directory.GetFiles(path, "*.txt").Count
At the moment only how to count the files in the directory folder thats where im stuck i got no clue on how to get the other parts done sorry.
yes Read Multiple text file from a folder and count specific words from those text files
as shown in example
Thank you in advance.
|
|
|
|
|
|
Hi,
I tried this but it only reads one file in my directory ( the last file in my directory )
I want it to read all the files in my directory if it has the pharse and then output the value
<pre lang="vb">
Dim strFiles() As String = Directory.GetFiles("D:\Logs", "*.txt", IO.SearchOption.TopDirectoryOnly)
Dim strLines() As String
Dim sb As New StringBuilder
Dim intDm1 As Integer
Dim intSm5 As Integer
For j = 0 To strFiles.Length - 1
strLines = File.ReadAllLines(strFiles(j))
intDm1 = 0
intSm5 = 0
For k = 0 To strLines.Length - 1
If strLines(k).Trim.StartsWith("DM01") Then
intDm1 += 1
ElseIf strLines(k).Trim.StartsWith("SM05") Then
intSm5 += 1
End If
Next
sb.AppendLine(" Found DM01 " & intDm1 & " times, SM05 " & intSm5 & " times in the file """ & IO.Path.GetFileName(strFiles(j)) & """")
Next
TextBox4.Text = sb.ToString
Is there anyway to do that ?
|
|
|
|
|
You need to re-examine the parameter order in your call to GetFiles()
|
|
|
|
|
I cannot see anything obviously wrong with your code, so it should do what you want. I can only suggest you run it in the debugger to try and find out what is happening.
[edit]
I just ran this code and it works correctly. Your problem must lie elsewhere.
[/edit]
modified 23-Mar-18 5:52am.
|
|
|
|
|
There should be an exception handler in there, otherwise he'd have the original problem again
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
I thought there was something about an UnauthorizedAccessException or something; must be confused with another question.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
|
I AM TRYING TO READ ARABIC QR CODE I HAVE GOT STRING LIKE THIS:
"0E" & ChrW(2) & "!پù;ر-ً" & ChrW(5) & "üà1" & ChrW(18) & "ثV½›H$»سè" & vbBack & "“أK»V¢®؛" & ChrW(21) & "*" & ChrW(2) & " |" & ChrW(26) & "M§" & ChrW(18) & "uس/ءd'ق" & ChrW(15) & "•qw}َ" & ChrW(22) & "î" & ChrW(31) & "ِه" & ChrW(30) & ">›جWگ¢Kh" & vbCr
IF YOU PLEASE I WANT TO CONVERT IT TO REAL STRING
THANK YOU
|
|
|
|