4,901 Posted Topics
This is a short bit of code that shows how to implement sorting on columns in a details-mode ListView. Suggestions for improvement are always welcome. One possible improvement would be to modify the column headers to indicate which column is being sorted and in which direction. | |
Re: Depending on how the smaller image was made you may not get a match comparing pixel by pixel. I have found that even using a (supposedly) lossless crop on jpg source files there are differences in at least one pixel. However, if your source files are bitmaps you should find … | |
Re: You just replace ".\SQLEXPRESS" with the name of the new server. Depending on the security setup you may have to change to a username/password authentication. If authentication will be based on the windows domain username then you can use the existing Integrated Security. | |
Re: Try using a forward slash "/" instead of a backward slash "\" as the date field separator. | |
Re: In order to sort on a column when you click on it you have to create a sort class for that column. The sort class must be defined as implementing the IComparer interface. This is required because the actual sorting code (which you do not have to write) does not … | |
Re: What is it you are having trouble with? Is it the format of the query or is it getting the info from the combobox? A typical update query looks like UPDATE myTable SET postalCode = 'R2C3N1' WHERE zone = 'East Kildonan' AND streetNumber BETWEEN 1600 and 1699 | |
Re: The following code requires three combo boxes. Each contains the integers from one to five. the button btnNext will stay disabled until the sum of all three combo boxes is ten or greater. You coold always modify the AddCombo routine, perhaps, to display a string in the textbox something like: … | |
Re: At least his girlfriends don't leave hairballs on the floor for him to find with his bare feet at 3 AM in the dark (gross). | |
Re: What is the format of a globe telecom number? The regular expression for four digits is "\d(4}". I can be more precise if you are more specific about the format. | |
Re: For Each line As String In System.IO.File.ReadAllLines("myfile.txt") Dim fields() As String = line.Split(vbTab) Next After the Split, fields will contain all of the fields in the input line, one field per entry. Forename, Surname and EmployeeNumber are fields(1, 3 and 5) respectively. | |
Re: Why don't you start by telling us the structure of your tables, and the nature of the information you want to extract from them. If you can do that in English (instead of code), perhaps we can build a query that will get that data directly from the tables without … | |
Re: If you have the centre point of a rendered circle you can find the radius by scanning pixels either horizontally or vertically until you find an edge, providing the circle is filled with a uniform colour and you can detect the edge by examining the pixels. I had to write … | |
Re: You have to be more specific. For example, you want to remove spaces. Do you mean leading, trailing or embedded spaces? You can remove leading and trailing spaces with Trim. You can remove embedded characters, space or otherwise, with Replace. mystring.Trim() 'remove leading and trailing spaces mystring.Replace(" ","") 'remove all … | |
I need to get the value of one field out of a web page. I've never done web programming and I've never used the VB Web controls. I have no desire to learn all of the details because I doubt I'll ever have to do this again. I have a … | |
Re: Perhaps if you don't know how to code in vb.Net, a Hospital Management System is not the best first project. I suggest you get a copy of Sybex - Mastering Visual Basic 2010 by Evangelos Petroutsos. You might want to have a look at the free online [msdn video series](http://channel9.msdn.com/Series/Visual-Basic-Development-for-Absolute-Beginners/) | |
Re: If the Sub doesn't return a value then you either have to have the sub modify a parameter (not recommended) or modify a private variable which is then accessed through a readonly property. | |
Re: Use the Leave event in the first textbox as in Private Sub TextBox1_Leave(sender As Object, e As System.EventArgs) Handles TextBox1.Leave TextBox2.Text = TextBox1.Text TextBox3.Text = TextBox1.Text End Sub This code will be executed as soon as the user leaves the TextBox1 control. | |
Re: A percentage of what? Are you having problems with the calculation or with the conversion (formatting) for display? | |
Re: For every keystroke. Add this event handler and you will see. The titlebar will be updated every time you press a key. Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged Me.Text = TextBox1.Text End Sub | |
Re: You only need Application.DoEvents() if you are in a lengthy loop. You aren't doing any loops here so don't use it. oSheet = oBook.Worksheets(1) You don't need this inside the With at line 19. It's already been set outside on line 17. If you are setting the values of single … | |
Re: Declare a variable with Class scope and save a reference to the textbox in that variable. The proper way to create the control is as follows: mytextbox = New TextBox() mytextbox.Location = New Point(130,y) Me.Controls.Add(mytextbox) Then to get the entered text just use text = mytextbox.Text | |
Re: SQL queries are normally case insensitive, however you can force a query to be case sensitive. In the following two queries, the first is case insensitive and the second is case sensitive select * from myTable where myID = '34WASH' select * from myTable where myID COLLATE Latin1_General_CS_AS = '34WASH' … | |
Re: I'm not as concerned with him posting religion based material. In Geek's Lounge pretty much any topic is fair game. What concerns me is the posting of misleading, and in some cases, completely inaccurate material. From my reading (which includes sections from the Q'uran) Islam is not a religion of … | |
Re: I don't see anything in the WHERE clause that restricts the selection to a particular "Person ID". | |
Sometimes sorting data can be easy and sometimes it can be difficult. If you have data in a listview you can spend a great deal of time writing ICompare functions. This is appropriate for non-trivial applications but can be a little intimidating for inexperienced programmers. Also, it is a problem … | |
Re: Try setting the command to this string first cmd.CommandText = "Update HallTransaction Set status=@statu where ID=@custid" and don't forget to put single quotes around text fields. | |
Re: I'm not up on oledb. I pretty much stick with ADO so my example uses that. You have to split the input line into fields. You do that with (what a coincidence) the Split method Dim sr As New StreamReader("d:\temp\test.txt") Dim con As New ADODB.Connection Dim qry As String con.Open("Driver={SQL … | |
Re: Very inefficient way to test for odd or even. A better way is (number And 1) = 0 This evaluates to True if number is even and False if it is odd. | |
So how is the media going to spin this so that all the issues will be discussed except the one that really matters? What hoops are the politicians going to jump through so that they can appear to be doing something but actually leave things exactly as they are now? … | |
Re: How elaborate do you want to get. A very simple solution is [Stickies](http://www.zhornsoftware.co.uk/stickies/index.html). This is a replacement for the Windows sticky-notes app. It supports alarms (you can put a sticky to sleep, visibly or invisibly) and have it alarm on a given date/time. Or you can leave a to-do sticky … | |
Re: Perhaps a slight mod to the above suggestion, save one line per family member with 50 boolean values for the 50 states (in alphabetical order). That way you don't have to change the file format or the input/output logic if you want to add another person. Mom,T,T,F,F,T,F... | |
Re: I received the same PM as did Mike_2000_17. It's being looked into. | |
Re: The first thing I would check is to test the app on both machines using exactly the same input data. Another possible source of the extra blanks is from the user. Could the user be introducing the blanks on the form? I don't know what data is in the first … | |
Re: Depends what you mean by "field". To clear a text control you set the Text property to the null string as in TextBox1.Text "" | |
Re: > Label3.Text * txt1.Text You should convert the strings to numbers before performing numeric calculations. > If CheckBox8.Checked = True Then txt8.Visible = True Else txt8.Visible = False This can be simplified to txt8.Visible = CheckBox8.Checked Also, you might consider creating these controls at runtime and saving references in an … | |
Re: Mostly the constant ringing in my ears (sucks getting old). I listen to everything buy country and rap. I keep returning to Ray Lynch. | |
Re: You are looking for commercial software likely costing many thousands of dollars. I strongly suspect that you will not find a freebie here or anywhere. That type of system is usually highly specialized and (usually) customized to some degree per site. | |
[This](http://mikegrouchy.com/blog/2012/06/write-less-code.html) is an excellent, non-technical article on programming that I think every programmer should read at least twice. | |
Re: Add single quotes around non-numeric fields and make sure that all of the variables you are using have valid values. comm.CommandText = "INSERT INTO Cust_Details(Cust_ID, CustName, Gender, Age, Phone, CustAddress) Values (" & custid & ", '" & custname & "','" & gender & "'," & age & ",'" & … | |
Re: >One thing I noticed is many people are 'speaking in code' If you mean code as in computer code, except in the trivial case I try to post comments and explanations with my code. In my "read this before posting" thread on the vb.net forum I encourage posters to organize … | |
Has anyone ever put together a map or table that shows the distribution of DaniWeb members across the globe? I don't know if such an analysis is possible but it might be interesting to see, roughly, where everyone is. | |
Re: How many items do you have in your ListView? Use the debugger and put a breakpoint at line 8 then compare your ListView items with the index. Also, get rid of the goto. If you must use a loop then use a structured loop. | |
Re: My two cents - you try to open the database (lines 14-22) but you continue on and try the query even if the database doesn't open. If the open fails then you should not try the query. | |
Re: We used IBM Thinkpads at the office for years. I was so impressed with the quality that I bought one for my younger son when he graduated from high school in 2003. It's been through the mill but it is still running. These things are rugged and dependable. When we … | |
Re: Instructions on how to save settings can be found [here](http://www.daniweb.com/software-development/vbnet/threads/427539/automated-reference-number-and-save). | |
Re: You can simplify the loops by using For Each phCheck As CheckBox In Me.Controls.OfType(Of CheckBox)() That will iterate through only CheckBox controls. | |
Re: Wasn't this already asked and answered [here](http://www.daniweb.com/software-development/vbnet/threads/429049/how-to-replace-a-line-of-a-txt-file)? | |
Re: You run a query on the database to determine if the room is booked for the requested time. I can't be any more specific becuase you haven't provided any details. But as an example, assuming that bookings are for one hour periods, then the query select * from bookings where … | |
Re: System.Convert.ToInt32("9a12c",16) As long as the first argument is a string representation of a hex value this will work. In the general case, the first argument is a string and the second argument is the base so you could also use this to convert other bases such as System.Convert.ToInt32("203",8) which would … |
The End.