4,901 Posted Topics
Re: You'll have to read all of the lines into an array, modify the requested line, then write the array back out to the file. All you are doing is modifying the line in memory. Dim lines() as String = IO.File.ReadAllLines(MYFILE) For i As Integer = 0 to Ubound(lines) If lines(i).Contains(... … | |
Re: I don't recall that we ever had a view counter. Of course, that could just be me. | |
Re: You can start by setting the values of min and max outside the loop as follows Dim min As Integer = Integer.MaxValue Dim max As Integer = Integer.MinValue InputBox returns a string so you can't assign it directly to a numeric variable. You have to convert it. However, just because … | |
I happened to be browsing the code snippets in vb.net and I noticed that in the thread list, a code snippet I contributed a while back is credited to "Reverend Jim", however when you go to the [actual snippet](http://www.daniweb.com/software-development/vbnet/code/423678/create-controls-at-run-time-with-events), it is listed as >By It's just a nickname on May … | |
Re: Tell me in English (not in code) what you want (not just the last part put the whole thing) and I'll see if we can come up with something simpler. | |
Re: You don't need to create a bootable disc (or USB) to install Office. You have to have Windows running in order to have somewhere to install Office to. You only need to create bootable media in certain cases such as * to install or reinstall your operating system * to … | |
Re: First you get the "sermon". Since you are required to write pseudocode anyway, write it first, then prefix each line of pseudocode with a single quote. There. You have just created all of your code comments. Now add the actual code. End of sermon. Now a few suggestions. InputBox("Values must … | |
Re: In SQL, to select the largest value from a set of values you use the MAX function as in select MAX(citation) from myTable | |
Re: I'm a big fan of letting the computer do as much as it can for you. Generally, the less code I have to write, the fewer chances I have to introduce a bug. In that case: Dim mylist As New SortedList(Of Date, String) For Each line As String In System.IO.File.ReadAllLines("d:\temp\test.txt") … | |
Re: My.Application.CommandLineArgs returns an array of strings, one string per argument | |
Re: The answer is "it depends". It depends on the type of database (Access, SQL, mySQL, etc), and it depends on the actual data in the field. You can use wildcards in SQL queries such that if your query looks like select * from myTable where MovieName like 'Rocky%' then the … | |
Re: You have to use a ListView in details view if you want to use different colours for each line. You can do it as follows: Dim item as New ListViewItem() item.Text = "Bad" item.ForeColor = Color.Red ListView1.Items.Add(item) | |
Re: I can't imagine how you would do this. When the power goes out your computer goes down immediately. If you have a UPS then the computer doesn't know the power is out. If you have a UPS that can send an event to the operating system then you have to … | |
I just submitted a code snippet for the competition [here](http://www.daniweb.com/software-development/vbnet/code/428716/using-detached-recordsets-to-sort-data). I entered my description/documentation, then entered the code after clicking on "Code" and pasting in the code window. I submitted the post and was then presented with another window saying "a fully working code snippet must be entered". So I … | |
Re: You just have to change the name of the server in the connection string. You may have to get the DBAdmin to set up access rights for you. | |
Re: I'd have your company lawyer contact the former admin. | |
Re: For once I find myself in complete agreement with Rashakil. If you are looking to better your job prospects then take a programming job, any job, that will get you experience. Programming in University is nothing like programming in the real world. In my opinion (and it is just my … | |
Re: Use & instead of + to concatenate strings | |
Re: The only time I ever had to program in binary was on an GE SPPC (stored program process controller) micro computer from 1979-1982. There were no symbolic debuggers (or debuggers of any type) at that time. To debug, you hand assembled some debug code then patched it into unused memory … | |
Re: It would help to know something about the input data. Are the lines in each file unique (within that file) or are there possibly duplicate lines? How big are the files (can you state an approximate maximum number of lines?). You read file 2 once for each line in file … | |
Re: You don't say what database you are using. If it is SQL then you can use the COALESCE function in the query. This function is used to replace NULL values with default values. For example: select LastName,MiddleName,FirstName from myTable May return NULL values for MiddleName, however, the query select LastName,COALESCE(MiddleName,"(none)"),FirstName … | |
Re: I think the easiest way would be to create your own msgbox form. Make sure it has a fixed width font like Courier New and display is as Modal. | |
Re: The easiest way to check is to use a regular expression. Here is an example for your particular requirements: Imports System.Text.RegularExpressions Public Class Form1 Private Sub btnTest_Click(sender As System.Object, e As System.EventArgs) Handles btnTest.Click If Regex.IsMatch(txtTestStr.Text, "^[2-9]\d{2}-\d{3}-\d{4}$") Then txtResult.Text = "Match" Else txtResult.Text = "No Match" End If End Sub … | |
Re: "Something like" code can't be debugged. What I can do with what you have shown is offer some code that does what I think you want. The following scans the "My Documents" folder on my D: drive and colours the lines based on the age (in months) if the files. … | |
Re: Have you looked at [autoit](http://www.autoitscript.com/site/). There is a component, AutoitX, that can be created and used from within vb. | |
Re: How do you propose to click a button in a form that has not yet been opened? And why would you want to? | |
Re: Or even TextBox.Visible = Ctype(sender,CheckBox).Checked | |
Re: Try For Each Info As String In System.IO.File.ReadAllLines(AccFileR) Info = IDecode.decryptString(Info) 'Debug.WriteLine(Info) Accounts.Add(New Account(Info.Split(CChar(",")))) My.Forms.Main_frm.AccNumber.Items.Add(iCount) iCount += 1 Next | |
Web Site Not Responding I was trying to go to a thread this morning (06:20 Winnipeg time) and DaniWeb wouldn't display it. All I got was >The connection to the server was reset while the page was loading. I tried several times with the same result. In order to determine … | |
Re: When the picturebox is loaded with a picture you could put a string into the Tag property. When you click on the picturebox you can copy the Tag value to the TextBox. | |
I was trying to find a code snippet so I used the advanced search with the following parameters: Query String = encryption Forum = --VB.NET Type of Article = Code Snippet It came back with "No Results" When I did a manual search of code snippets under vb.net I found … ![]() | |
Re: If you want to handle all textboxes the same way you can create two generic handlers such as Private Sub TextBox_GotFocus(sender As Object, e As System.EventArgs) sender.BackColor = Color.LightGray End Sub Private Sub TextBox_LostFocus(sender As Object, e As System.EventArgs) sender.BackColor = Color.White End Sub then on form load you can … | |
Re: Or if you can't or don't want to group the controls, set the Tag property of each to some known value then test in a loop like For Each ctrl As Control In Me.Controls If ctrl.Tag = "my value" Then ctrl.Enabled = True End If Next | |
Re: To do that you create an installer package. When a user runs the installer it copies all of the files needed to run the application to the user's computer. You can find detailed instructions [here](http://msdn.microsoft.com/en-us/library/k3bb4tfd.aspx) | |
Re: And why is it called the “God particle”? Like God, it is everywhere but hard to find, goes the quip. In fact, the origin of the name is rather less poetic. It comes from the title of a book by Nobel physicist Leon Lederman whose draft title was “The Goddamn … | |
Re: Is it possible you have the wrong encryption settings for tis particular wireless connection? It's possible that one end is set to WEP and the other to WPA. Are you being prompted for a network key when you try to connect? | |
Forget the problem with commercials being blasted at you, I've noticed in a few of my regular shows lately, noticibly Burn Notice and Royal Pains, dialog is at one volume level, and the music that plays between scenes (camera pans over scenery/cityscape, etc.) is at three times the volume. It … | |
Re: >It converts information from hundreds of Excel documents into a few small text files Let's assume your Excel files are named ss-0001.xls, ss-0002.xls, etc. I'm guessing you have two processes at work here. One process runs independently of the GUI app and renders many Excel files into a few text … | |
In case no one has mentioned it before, I just want to say a public thanks to Davey for all of the interesting news items he finds the time to write up and post. | |
I think it would be nice to include the original posting date when a related article is suggested. I'd be more inclined to check it out if I knew the article was less than a few months old. More than a year, not so likely. | |
Re: It's possible the folder has had the S or System attribute set. Open a command (CMD) shell and locate to the folder that contains the missing folder. Let's assume (for this example) that the missing folder is called "dave". At the command prompt type the command attrib dave If you … | |
I just finished trying for the fourth time to submit a posting to the "Articles View" thread. Every time I click "Reply", the Reply button disappears but I am left in edit mode. | |
Re: I had the cursor offset problem an hour or so ago. I started typing this post and noticed that the cursor started having the same problem in this post. I tried re-entering all of the text to see if I could determine where the problem was occurring but I couldn't … | |
Re: If the string contains arbitrary numbers of substrings of the form "Kg###" then you can extract them all using a regular expression as follows Imports System.Text.RegularExpressions Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim test As String = "_A0+0000002 Kg054__A0+0000002 Kg055__ " Dim rexp … | |
Re: I've always been a big fan of letting the computer do as much work as it can. Don't bother writing the bubble sort. The following code uses a sorted dictionary. The key is the line number (with the "N" removed) and the value is the rest of the line. No … | |
Re: Usually, when you make resources on a server available to the network you do it through a share name (or Active Directory name) rather than by a physical path. For example, if your sdf file was physically located on a server named Hermes in the folder D:\database, the users would … | |
Re: A travelling salesman drives into a farmer's yard. As he gets out of the car he sees a three-legged pig walking by the barn. As the farmer comes over to greet him the salesman says, "I'm here to show you the new seed catalog but before I do I have … | |
Re: Drop a timer on your form. To get the timer to do something every one second, set the Interval property to 1000. To start the timer, set Timer1.Enabled = True. To execute code on every "tick" of the timer, put that code in the Timer1.Tick handler. To stop the timer … | |
Re: You can save the last used number in a settings variable. If you go to your project properties (see Project menu), then go to the Settings tab, you can add a settings variable of any time and scope. If the numbers are unique for each user then create a User … | |
Re: You could just use the command line ftp.exe with a script file that logs in and lists the directory and pipe the output to a file. |
The End.