4,911 Posted Topics
Re: The easiest way to write out the text is System.IO.File.WriteAllLines(filename, {empIDbox.Text,fnamebox.Text,lnamebox.Text,salbox.Text}) To read it back Dim text() As String = System.IO.File.ReadAllLines(filename) If text(0) = txtUpdateID.Text Then txtUpdateFirstName.Text = text(1) txtUpdateLastName.Text = text(2) txtSalupdate.Text = CInt(text(3)).ToString("C2") | |
Re: Check out [How Do I Put a Number Limit on a TextBox](http://www.daniweb.com/software-development/vbnet/threads/440145/how-do-i-put-a-number-limit-on-a-textbox) | |
Re: If txtUpdateID.Text = False Then Will never work because you are comparing a string to a boolean. The short form of showing/hiding a label depending on a comparison is Enflbl.Visible = txtUpdateID.Text = "some string value" If txtUpdateID.Text is equal to the string value then the label is shown, otherwise … | |
Re: >If TextBox1.Text > 1500 Then Doesn't work because you can't directly compare strings and numbers. Also If TextBox1.Text > "1500" Then won't work because "2" > "1500". If you limit your textbox to entering numbers only then you can do If CInt(TextBox1.Text) > 1500 Then To restrict a textbox to … | |
Re: Well happy birthday to you. I'm almost double that myself but my son at Stony Brook is just one year younger than you. | |
![]() | Re: Ray Lynch - Nothing Above My Shoulders But the Evening. |
Re: As far as I know, Access does not support temporary tables. However, you can create a table on the fly with SELECT INTO as in SELECT * INTO temptable FROM Customers WHERE Address LIKE '*C*' Just remember to drop the table when you are done. | |
This request arose from the discussion [OPINION: Who thinks MAKING A POST on these forums is horrible](http://www.daniweb.com/community-center/daniweb-community-feedback/threads/439477/opinion-who-thinks-making-a-post-on-these-forums-is-horrible). My comment on that thread was >If I am not logged in and I click on a link in my email, I am taken to that post. I can start typing a response … | |
Re: You can simplify the coding and make it more obvious by using this pseudo-code. It eliminates some unnecessary testing and setup. set low and high range for guess (lo=1 hi=100) read user number loop calculate guess as hi - (hi-lo)/2 if this is the correct number then exit loop if … | |
Re: What program was used to create the file? Do you have the code that was used? | |
Re: You are displaying the message, "Connection Established" before you even try to open the connection. I suspect you haven't specified the server name correctly. On my machine (using MS SQL) it is "Server=.\SQLEXPRESS;". When I try with either "Server=localhost" or "Server=(localhost)" I don't get the connection. Try this (with a … | |
Re: The SQL query you want is "DELETE From Student Where MajorName = '" & cmbMajorI.Text & "'" | |
Re: Execute the SQL reader before you check if there are any rows, then step through the records and populate the combobox as in Dim dr As SqlDataReader = SQLcmd.ExecuteReader If dr.HasRows Then Do While dr.Read() cmbName.Items.Add(dr(0)) Loop Else MsgBox("no records") End If | |
Re: You have another table which uses that primary key as a foreign key. If you delete that record then the other table will have an orphan (a record that doesn't point back anywhere). If you are using MS SQL you should be able to set up something called **cascading referential … | |
Re: I found that cramming right up to the exam time just got me extra wound up. What worked for me was to stop preparing a few hours before the exam, show up to the exam site an hour early with a cup of coffee and fine some place close by … | |
Re: Try changing strQuery = "INSERT INTO login (username, password) values (" & txtUser.Text & "', '" & txtPwd.Text & "');" to strQuery = "INSERT INTO login (username, [password]) values ('" & txtUser.Text & "', '" & txtPwd.Text & "')" Looks like you missed the single quote before the first value. … | |
Re: Read the error message. You have to declare the variables and objects with types. Without seeing the form (and properties) I can only assume you created text boxes but left them with the default names (like TextBox1) instead of renaming them (like txtTown). Also, for loop variables you can declare … | |
Re: Name your fields explicitly. If your table has more columns than specified values the insert will fail. The format is INSERT INTO table (fldname1,fldname2,etc) VALUES('value1','value2',etc) Keeping in mind that you don't need the single quotes around numeric fields. Also, by explicitly naming your fields you make the insert independent of … | |
Re: For i As Integer = 1 To 49 Step 2 | |
Re: They say "don't ask the barber if you need a haircut". I think this applies here as the survey was done by an organization that definitely has something to gain by FUDding. In all the years I have been online (at work and at home) I have only (maybe) been … | |
Re: I don't know how you are going to manage a progress bar because the RESTORE command, even if running in a background thread, will not report back the progress of the operation. It will just halt the execution of the thread until it completes. The best you'll do is display … | |
Re: Do a query to select the record with that ID. If it returns a record then you know that it exists. Dim myID As String = "123" query = "SELECT * FROM myTable WHERE company_ID = '" & myID & "'" or even query = "SELECT COUNT(*) FROM myTable WHERE … | |
If I go to a forum (VB.Net in this case) I see a number of threads marked as NEW. I select one thread somewhat down the list and open it. I respond to the question, then redisplay the VB.Net threads. All of the NEW flags have now been removed. Is … | |
Re: @anaconda Your If block will not work as you expect because you are comparing strings (txtMonth.Text) to integers. A date picker is a better method for date selection. | |
Re: Instead of "SELECT Class FROM Class" use "SELECT DISTINCT(Class) FROM Class" | |
Re: I have heard good things about [PC Decrappifier](http://www.pcdecrapifier.com/). It's free for personal use. | |
Re: What database are you using? MS SQL uses the COALESCE(field,value if NULL) function while MS Access uses NZ(field,value if NULL) function. | |
Re: That will tell you whether the machine is on the network but does not tell you if the server is up. Of course, "up" is open to interpretation. If you are running multiple services (FTP, WEB, etc) what can be non-responsive before it is considered not to be up? | |
Re: When I run the following code Private Sub Button_Click(sender As System.Object, e As System.EventArgs) Handles btnCol1.Click For i = 1 To 100 ComboBox1.Items.Add(i) Next End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ComboBox1.Items.Clear() For i = 1001 To 1010 ComboBox1.Items.Add(i) Next End Sub I get what … | |
![]() | Re: Unfortunately you have one side that has demonstrated it will do anything to win including obstructing government, voter registration fraud, lying and bankrupting the country. Also unfortunately, you have another side that still thinks it is possible to "play nice" with the other side. Maybe if I explain to him … |
Re: "Password" is a reserved word in SQL. Try mystring = "UPDATE ClientLogIn SET [Password] = '" & PasswordTextBox.Text & "' WHERE ClientID = '" & ClientIDTextBox.Text & "' AND Username = '" & UsernameTextBox.Text & "'" | |
Re: A textbox, by definition, contains text. Also keep in mind that "0" is not equal to 0 The first is a string containing one character, the other is an integer. Everything is stored internally as numbers. The number zero has a value of (you guessed it), 0. However the character … | |
Re: You haven't created the objects. The statement Dim cn As OleDb.OleDbConnection says "allocate a variable named cn that can be used to access an OleDbConnection object. That statement doesn't actually create the object (it isn't pointing at anything). You need to use Dim cn As New OleDb.OleDbConnection This creates the … | |
Re: Here's an example using the Microsoft PUBS sample database. ListView1.Items.Clear() Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;") Dim cmd As New SqlCommand con.Open() cmd.Connection = con cmd.CommandText = "SELECT au_lname,au_fname,zip FROM authors" Dim rdr As SqlDataReader = cmd.ExecuteReader If rdr.HasRows Then Do While rdr.Read() Dim item As New ListViewItem item.Text = rdr("au_lname") … | |
Re: If you go into design view, right click on the listview and select "Edit Columns" you will see the names of all the columns (you can change these names). You can use these names to modify the header text at runtime as in ColumnHeader1.Text = "new header text" If you … | |
Has anyone looked at why I can't attach files to posts using FireFox? I'm currently on FireFox 16.0.2 but I had the same problem with previous versions. | |
Re: The trick is to ensure that a NULL is not returned when you query the table. This can be accomplished using the NZ function. For example SELECT lastName,middleName,firstName FROM mytable might return a NULL for middleName when there is no entry for that field, however SELECT lastName,NZ(middleName,""),firstName FROM mytable will … | |
Re: I wrote something similar while troubleshooting a wireless internet connection this summer. You are welcoome to have a look if it will help. You'll find it [here]( http://static.daniweb.com/images/attachments/3/2012-11-03_10-33_InternetMonitor.zip). It uses three background threads to monitor * The wireless hub (192.168.1.1) * two DNS although you can enter up to three … | |
Re: First suggestion is to declare the parameter types in AddUserFun as Function AddUserFun(user As String, pass As String, acclvl As Integer) As Integer and at the top of this function you can add (for now) Debug.WriteLine("ADD user=" & user & " pass=" & pass & " acclvl=" & acclvl.ToString()) If … | |
Re: Here is a sample of traversing a simple xml structure Dim myxml = <root> <level id="1"> <prop n="PROPERTY" v="VALUE"/> </level> <level id="2"> <prop n="PROPERTY" v="VALUE"/> </level> </root> For Each level In myxml.Elements Debug.WriteLine("id=" & level.@id.ToString) For Each prop In level.Elements Debug.WriteLine("n=" & prop.@n.ToString & " v=" & prop.@v.ToString) Next Next | |
Re: Can you please explain in more detail? | |
Re: The problem is that Microsoft unilaterally decided how you were going to use Windows 8. Metro is clearly designed for tablets with touch screens but just try using a touch screen on a desktop for productivity type work. Tired arms and smudges. They could have given the user the option … | |
Re: My older son is currently living in Stony Brook, Long Island. His house was on a hill (60 feet above sea level) and survived intact. However, he spent the duration of the storm in his office at the University (which also survived intact - 40 feet abouve sea level). He … | |
Re: Once you have eliminated and flagged bad input values, the setting of the rate is simple when you realize that you have several cases. The first case is weight <= 2 kg, the second is weight <= 6, etc. That translates nicely into a select case structure. As long as … | |
Re: >There's a piece of code that disables all texts including special characters, it allows number only. I've been using it. That's of absolutely no help unless you are willing to post the code or a link to it. Also, to everyone who has posted here in the last few days … | |
Re: What are you having a problem with? Is it selecting the data from the database or is it displaying the data? | |
Re: It depends on what database engine you are using. For example, in Access you would do (depending on your system's short-date format) SELECT * FROM myTable WHERE thedate >= #2012-03-07# AND thedate <= #2012-09-15# but in MS SQL you could do SELECT * FROM myTable WHERE thedate BETWEEN '2012-03-07' AND … | |
Re: The above response merely displays the current date and time. To calculate the difference between two date/time values you do the following: txtTimeWorked.Text = DateDiff(DateInterval.Minute, CDate(txtTimeIn.Text), CDate(txtTimeOut.Text)) Assuming that the two fields used in the calculation both contain valid date/time values, it returns the elapsed time in minutes (in the … | |
Re: I wrote an app to monitor a troublesome internet connection. It uses three background threads to monitor three points. I've attached it to this thread and I'd be happy to answer any questions. It's not too complicated and I believe it illustrates some of the things you are trying to … | |
Re: I attached a sample project that implements a command shell inside a Windows form. I hope this helps. |
The End.