4,901 Posted Topics
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 … | |
Here is a question I do not recall being addressed. In the last week I have had to completely rebuild my system. Following a lengthy install and configuration I had to look for the locatiuon of a settings file for an application (to make a backup). Being a dinosaur, I … | |
Re: Once you get everything re-installed (OS, Apps, anti-virus, etc.), configured and all updates applied you might want to consider installing a disk imaging program (Macrium Reflect is highly rated and free for personal use). Take a disk image of your system partition and save it somewhere. If you get reinfected … | |
Re: Post (or attach) a few records from the database and I'll have a look at it locally. If you can zip and attachthe entire database then I'll also have the schema. | |
Re: Using a DLL does not decrease the speed of a process. Compiled code is compiled code whether it resides in a main module or a library. By putting common code into a DLL, however, you make it available to multiple projects without having to recompile it, and (as far as … | |
I have a form with a TableLayoutPanel with the following properties changed from default: Dock = Fill AutoSize = True AutoSizeMode = GrowAndShrink ColumnCount = 1 Margin.All = 0 one row set to AutoSize This is a stripped-to-the-basics version of part of my app. I want to generate a vertical, … | |
By a strange (and fortunate) coincidence, while DanaWeb was down for the upgrade I had to completely rebuiild my system due to a hard drive failure (fortunately I had warning so I had complete backups). However, I've noticed some odd behaviour since then that I don't know is the result … | |
Re: Each object (control) that you create is given a unique name by default, such as TextBox1, TextBox2, etc. which you are free to change as long as it remains unique. You can see that name in the properties view. Just refer to the object by that name. | |
Re: If you want to compare and ignore case you can use String.Compare(stringa,stringb,True) The third parameter is True to ignore case, False otherwise. It returns -1 if stringa < stringb 0 if stringa = stringb +1 if stringa > stringb | |
Re: In the AfterSelect event handler of the treeview you can do Dim text() As String = TreeView1.SelectedNode.Text.Split("-") Then your first textbox is Trim(text(0)) and the second textbox is Trim(text(1)) | |
The End.