4,911 Posted Topics
Re: ON ERROR RESUME NEXT is a holdover from the days before TRY-CATCH. It is still used in vbScript where the TRY-CATCH is not available. It was the only way to prevent your program from crashing on an error and typically resulted in endless error checking tests (ugly) such as on … | |
Re: You can do this in one step as Sub Main() Dim text As String = "line 1" & vbCrLf & "line 2" & vbCrLf & "line 3" & vbCrLf Dim path As String = My.Computer.FileSystem.CurrentDirectory Dim file As String = System.IO.Path.Combine(path, "myfile.txt") System.IO.File.WriteAllText(file, text) End Sub Modify the value of … | |
This code demonstrates how to add controls to a form at run time. The number of rows and columns, the spacing between the controls and the size of the controls are all determined by Consts, but this could easily be changed so that the parameters are user entered. My example … | |
Re: If you have a Windows 7 install CD/DVD you can boot from that. When the Install Windows page appears, click Repair your computer to access system recovery options. I hope this helps. | |
You'll undoubtedly get a lot of postings on this, but none of the buttons (Bold, Italic, Code, etc) controls on the forum are doing anything. I click and nothing happens. | |
Re: Docx files are created using newer versions of Microsoft Office Word. By adopting new file formats, Microsoft forces users of older versions of Word to upgrade needlessly thereby generating more obscene profits. But I'm not bitter. | |
Re: Create a listview control Set the View property to Details Right click on the control and select Edit Columns Add (and name) the columns you need (let's make it 3 columns) Declare a listviewitem variable Dim newitem As ListViewItem For each row you want to add do newitem = New … | |
Re: A much faster way to delete all records is "TRUNCATE TABLE tablename" | |
Re: Once you are in the Closing event handler you don't have to call Close() again. Here is a sample from one of my projects. It maintains a book library. When the user tries to exit the app it checks if there are unsaved changes then prompts the user for what … | |
Re: A couple of suggestions, if I may, while we wait for the info requested by Beginnerdev... Because you are only retrieving one column (catNo) in your first query, you should specify that column rather than \* in your query. The purpose of the query is clearer and (if you are … | |
Re: If you set the forms KeyPreview property to True you can use the following code Public Class Form1 Private Sub Form1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If Me.ActiveControl.GetType = GetType(TextBox) Then Me.Text = e.KeyChar Select Case e.KeyChar Case "0" To "9" Case Chr(Keys.Back) Case Else e.Handled = True … | |
Re: How are you opening/modifying/saving the data? Please post your code so we can tell you where you are going astray. Are the duplicate rows being inserted or are they being appended to the worksheet? | |
Re: if you Import System.Text.RegularExpressions then you can use the following test If RegEx.IsMatch(textbox.Text,"\d{4}\.\d{2}") Then 'the text matches the pattern ####.## Else MsgBox("the text must be in the form ####.##") End If 'or if you don't want to do the import you can fully qualify as If System.Text.RegularExpressions.RegEx.IsMatch(textbox.Text,"\d{4}\.\d{2}") Then 'the text … | |
Re: Dim tokens() As String = "17:55:88".Split(":") This will give you an array with indices from 0 to 2 where tokens(0) = "17" tokens(1) = "55" tokens(2) = "88" | |
I know you are busy fixing bugs and tweaking (and I very much appreciate the effort) but I have a suggestion to slightly tweak the email notification. The old system would not send an email to tell me that there was a new posting on a watched thread if the … | |
Re: It sounds like you are willing to get technical. A really good book is Object Oriented Analysis and Design by Grady Booch. Daniel R. Clark also has a book, Beginning Object-Oriented Programming with VB 2005 From Novice to Professional. | |
Re: The items in a treeview already have a + or - symbol to the left which when clicked will show or hide child nodes. | |
Re: > Dim regBaseKey new As RegistryKey = Registry.LocalMachine Instead of Dim regBaseKey new As RegistryKey = Registry.LocalMachine try Dim regBaseKey As New RegistryKey = Registry.LocalMachine | |
Re: You are trying to assign a string value to an integer variable. In order to do the assignment you should first (as stated by jwdunne) determine that the conversion is possible. If the conversion is possible you can use Convert to do the conversion as in Dim b As Integer … | |
Re: In that case you are misusing the term "exact". Unless you mean you want a result of 1 when the difference is exactly one year. If you are not interested in fractions of a year then do as was suggested and find the difference in days then take the integer … | |
Re: You could do For Each s As String In {"0", "12", "345", "6789"} Debug.WriteLine(s) Next | |
Re: Can you please clarify? What are the contents of the text file and how do you want it parsed to go into the datagrid? What is the layout of the datagrid? An example might be "I have a text file containing lines of comma separated values. I want to display … | |
REF: http://www.daniweb.com/software-development/vbnet/threads/422252/retrieve-and-save-to-another-excel-workbook I submitted a post recently. The post did not appear, even when I refreshed, then closed and reloaded the page. This has happened before so, fortunately, I had copied my post text to the clipboard. I submitted the post again. This time is was accepted and displayed. When … | |
Re: What you are describing is more of an *irregular* expression. Your character classes need not be in any particular order. I believe you are far better off handling the validation in code. This will be clearer and more maintainable. Also, your requirements appear to be in conflict > atleast one … | |
Re: Can you post an excel file with some sample data which causes the problem you are describing? | |
Re: The only difference I have seen in various defraggers is the minimum free space required for them to work. At the time (pre Windows 7) PerfecDisk worked with as little as 5% free space. Since I installed Windows 7 I have not bothered to install a third party defragger. | |
Re: First step is to search this forum. That's what the big SEARCH box at the top is for. If you do that you will find [this code](http://www.daniweb.com/software-development/vbnet/code/366392/encryption-and-decryption-functions-in-vb.net) | |
Re: If you are using a recent version of SQL server (2005 or newer) you can use the new ranking functions. Your specific query to generate the above results would be SELECT TOP 5 RANK() OVER (ORDER BY IAVERAGE) AS Rank, USERNAME,ICOUNT,IAVERAGE,DATE_LOGGED FROM MyTable WHERE IAVERAGE > 0 AND DATE_LOGGED='05-07-2012' RANK() … | |
Re: Silly question - why not just have one field on the form for "name"? What possible reason is there to have it more than once if you are just going to replicate it? | |
Re: Do you need help with the database update as well? The answer would depend on whether you need help with the query itself or the connectivity. And the answer may depend on what type of database you are using and how you are storing the date/time value. | |
Re: You can define one handler to be used for all of the buttons and determine which button was clicked by checking the Text property in the event handler. Can you be more specific as to what you mean by "five separate functions for each button's click event"? | |
Yesterday I clicked "Mark Forum Read" in the VB.Net forum. Today I am seeing articles for which the most recent postings are 2-3 days old being flagged as NEW. | |
Re: I rather doubt it. In four code mudules you have around 6 comments, mostly consisting of 2-3 words and those are in Spanish. You haven't said where in the code you are having the problem (apparently it is up to us to scan through undocumented/uncommented code and figure it out)., … | |
Re: Instead of asking how to implement a particular solution, you may want to ask youself if the solution you have picked is appropriate for the problem you are trying to solve. Perhaps if you tell us the underlying goal we may be able to offer a better approach. | |
Re: When you insert a record, no other records are affected. A typical insert looks like insert into [tablename] (list of field names) values(list of field values) In this case, only one record is ever inserted. To delete a record the format is delete from [tablename] where [sequence of fldname=value clauses] … | |
I know it's been busy with the rewrite and tweaking but I haven't seen a newsletter issued in ages. | |
Re: You select records from a database using the SELECT statement. You can select all fields or a series of named fields. For example select * from Employees select FirstName, LastName, Salary from Employees The first statement selects all fields, the second selects only the named fields. All records in the … | |
Re: What are the items in each and how are the items in combo2 supposed to be restricted after combo1 is selected? | |
I'm confused (not an uncommon state lately, I'm afraid). A short time ago I posted some VB code using the CODE button. In response I was told by pyTony that I should be using fences. Today when I went to post some code, the posing area had a large banner … | |
Re: How about [code] Private Function Rotate(ByVal s As String, ByVal places As Integer) places = places Mod s.Length If places < 0 Then places += s.Length Return Mid(s, places + 1) & Mid(s, 1, places) End Function [/code] Try a few values (positive and negative) for "places". Note the "mod" … | |
Re: Keep in mind that just because you can solve a problem with recursion it doesn't mean that you should. Traversing a binary tree is a good example of where recursion is desirable, and actually produces clearer code than alternatives. Calculating factorials is a usual example to teach recursion. But that's … | |
Re: To make it more general you could replace >= 2009 with DATEPART("YEAR",GETDATE())-3 | |
Re: It sucks (abandoning WinForms). I'm awfully tired of Microsoft pushing their "latest and greatest", then abandoning it for the next "latest and greatest". Because I develop apps only for my personal use I will likely just continue usinig WinForms under Visual Studio 2010 as long as it continues to run. … | |
Re: Can you please clarify? An inner join is used to create a virtual (temporary) table that is the result of combining two other tables based on a (single) common column. Perhaps if you posted the schema of the two tables, and the schema of the virtual table you want as … | |
Re: Can we get back the ability to sort the threads based on the starting date? The first thing I always did when going into a forum was set the display to show newer threads first. Perhaps this could be added as a default in the control panel. | |
Re: There is no event that I am aware of that triggers when you open a file from within your program. You don't need an event triggered because you are already executing code, starting with the method you called to open the file. As for "open with", you can set your … | |
Re: Post your code. When I used the following code it worked fine. ~~~ vb Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedIndex End Sub ~~~ | |
Re: You can find a step-by-step tutorial [here](http://msdn.microsoft.com/en-us/library/k3bb4tfd.aspx) | |
Re: That's somewhat different from the old style of code tags and definitely not intuitive. Is there any place that explains how the new system works? For example, as I am typing, the code tag in the first sentence is blue and underlined and everything following that is red. I don't … |
The End.