476 Posted Topics
Re: Why not use the My namespace? [ICODE]My.User.Name[/ICODE]. It gives the name of the currently logged on user and would save you a whole shrew of coding. | |
Re: First of all, I'm recommending that you download and install the MySQL Connector for .NET, instead of using ODBC. It's available from the MySQL site. Then, for inserting data into the database will be practically the same as using a MS SQL database. [CODE=VB] Imports Mysql.MySqlClient Private Sub MainForm_Load(yadda yadda … | |
Re: Try this: [CODE=VB] Imports System.Data.OleDb Imports System.Text Public Class mainpage : Inherits System.Windows.Forms.Form Dim con As New OleDb.OleDbConnection Dim cmdOle As New OleDb.OleDbCommand Dim da As OleDb.OleDbDataAdapter Dim dtOle As DataTable Dim sql As String Private Sub find_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles find.Click con = New … | |
Re: (1) PHP has no real definition, ie: var $a_var;. In VB.NET you must define what the variable will contain, ie: Dim a_var As Integer Dim another_var As String (2) PHP uses the C syntax for iterations: for (var $i = 0; $i < 10; $i++) { } while ($a_var < … | |
Re: You might wanna look into the [URL="http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol"]SNMP[/URL] protocol. However, it would be quite pointless unless your switches are of the Managed type. | |
Re: You do need a licence for Visual Studio 2005 Professional Edition. But if you have already created a program using VB.NET, then you are the owner of said program and thus don't need any type of licence. So to answer your question: You don't need Visual Studio in order to … | |
Re: Your codesnippets look suspiciously at lot like this project: [URL="http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx"]http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx[/URL]. If you read through the authors documentation carefully you will see how to implement what you're looking for. | |
Re: In Visual Studio 20005/2008 you can add a new connection through a wizard. At one point the wizard tells you that you've selected a local data file that's not in the current project, and asks if you would like to copy the database file to your project folder. Choosing NO … | |
Re: [ICODE]combobox1.GetItemText(combobox1.SelectedItem)[/ICODE] returns the text for the currently selected item. This writes a line of string into a file. [CODE] Private Sub SaveToFile(fileName As String, data As String) Dim stream As New System.IO.FileStream(fileName, FileMode.Create) Dim sw As New System.IO.StreamWriter(stream) sw.WriteLine(data) sw.Flush() sw.Close() End Sub [/CODE] | |
Re: How about something like this. [CODE] Dim line As String Dim Input As StreamReader Dim PolicyIdCode As String Dim strFile As New ArrayList PolicyIdCode = TextBox19.Text Input = File.OpenText("Policy Details.txt") ' Loop through the file While Input.Peek <> -1 ' Read the next available line line = Input.ReadLine ' Check … | |
Re: Keep the newest/current version of the project in a database. Create a Webservice/WCF service that presents that version online and has a file copying method. Also, create a small Updater utility that goes with your larger project. Then add a reference in your project to the service, and compare the … | |
Re: The ComboBox control has two properties called AutoCompleteMode and AutoCompleteSource. Change AutoCompleteMode to [B]Suggest[/B] and AutoCompleteSource to [B]ListItems[/B]. | |
Re: [CODE] IF dataReader.Read() Then If Not IsDBNull(dataReader("dateColumn")) Then Dim dateTest As DateTime ' Test to see if the value in the database is a date If DateTime.TryParse(dataReader("dateColumn"), dateTest) Then If dateTest = DateTime.Now Then ' Do something End If End If END IF End If [/CODE] | |
Re: 'Code for retrieving the table from the database. TextBox1.Text = dataTable1.Columns(0).ColumnName | |
Re: One step at a time. Start by grabbing a pen and paper, and design the logic of your project. | |
Re: Something like this. [code] Private Sub CompareMonths() 'I don't know what DataSet.Repair is or does. Dim currentMonth As Integer = DateTime.Now.Month Dim parseMonth As Integer = 0 Dim parseDate As DateTime = Nothing ' Iterate all rows in table For Each row As DataRow In DataSet.Tables(0).Rows ' Check if field … | |
Re: [CODE] Public Position As Integer Public Function Fibonacci() As Double If Position > -1 Then 'A for loop End If End Function Public Function Fibonacci(ByVal position As Integer) As Double ' A Do Until loop End Function [/CODE] | |
Re: Here's what I usually do, following Luc001's example. Add a handler for the FormClosed event. When you close the newly opened form, the event will be triggered and dispose of the object. And any future openings of the form will be with a fresh copy. [CODE] Public Class Form1 Private … | |
Re: For ListView you should not use SelectedItems in this manner. SelectedItems is a collection of selected items (rows) in the ListView. So, if there's only 1 row selected then SelectedItems only contain 1 item. Therefore LVW.SelectedItems(1) will result in error. If you wish to retrieve values from the subsequent columns … | |
Re: I'm not entirely sure why you get the error. But I'm thinking you had the thought of using the index in [ICODE]Public Sub RedrawMap(ByVal index As Integer)[/ICODE] for something. Perhaps a layer or object index? | |
Re: How about creating a class instead. That way you will be able to gather all calculations in one place. Here's a simple example. [CODE] 'In your form Private clsAddItem As AddItemClass Private Sub button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button.Click clsAddItem = New AddItemClass("book title") TaxLabel.Text = … | |
Re: If you Google with the keywords "vb.net gdi+ animation" you will find that there is a lot of guides and tutorials out there for how to accomplish this. Here's one, for example: [URL="http://www.freevbcode.com/ShowCode.asp?ID=5601"]http://www.freevbcode.com/ShowCode.asp?ID=5601[/URL] | |
Re: You have two options. 1) Create an object with the scores and use serialization for storing into a file. [URL="http://www.switchonthecode.com/tutorials/csharp-tutorial-serialize-objects-to-a-file"]http://www.switchonthecode.com/tutorials/csharp-tutorial-serialize-objects-to-a-file[/URL] 2) Store the scores in the Registry. [URL="http://www.codeproject.com/KB/vb/registry_with_vb.aspx"]http://www.codeproject.com/KB/vb/registry_with_vb.aspx[/URL] | |
Re: Close, but no cigar. Try it like this instead. Notice that I removed some single-quotes and changed the plus-sign (+) into an ampersand (&). [CODE] ODBC_COM = New OdbcCommand("UPDATE President SET " & President_UPDATE_field.Text & " = '" & President_UPDATE_text.Text & "'", ODBC_CON) ODBC_COM.ExecuteNonQuery() [/CODE] Also. If you put it … | |
Re: Is the form you're trying to submit actually the form you stated on this line: [ICODE]WebBrowser1.Document.Forms(1).InvokeMember("submit")[/ICODE]? If the page only has one form, then the line should probably read: [ICODE]WebBrowser1.Document.Forms([COLOR="Red"]0[/COLOR]).InvokeMember("submit")[/ICODE] | |
Re: A suggestion: Add a class variable of type List(Of Object). For each time you press the btnCalculate button you add totals(,) to that variable. Then iterate through the list and add it's content to a string variable that you display in a MessageBox. Example: [CODE] Private Sub example() Dim values … | |
Re: Have you also tried Invalidate() and Update()? | |
Re: Yes, it is. You should look into using WMI. An example: [URL="http://www.freevbcode.com/ShowCode.asp?ID=4571"]http://www.freevbcode.com/ShowCode.asp?ID=4571[/URL] | |
Re: In your code for btnRemoveLine, do this: [CODE] If lstMenuItem.SelectedIndex <> -1 AndAlso lstPrice.SelectedIndex <> -1 AndAlso lstQuantity.SelectedIndex <> -1 Then Dim index As Integer = lstPrice.SelectedIndex lstPrice.Items.RemoveAt(index) lstMenuItem.Items.RemoveAt(index) lstQuantity.Items.RemoveAt(index) End If [/CODE] | |
Re: How about this. Use the picturebox's Tag property and set it's values to a value that should go into these lines [ICODE]filled(0, [COLOR="Red"]0[/COLOR])[/ICODE]. Then you can do this: [CODE] Private Sub Change_Image(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click, _ PictureBox4.Click, PictureBox5.Click, PictureBox6.Click, _ PictureBox7.Click, … | |
Re: Or if you prefer the datareader, here's how it's done. [CODE] Private Sub cboPosition_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboPosition.Click scmd = New SqlCommand("SELECT KPIPOSTCODE FROM KKPIPOSITION", sqlcon) sqlcon.Open() scmd.CommandType = CommandType.Text dr = scmd.ExecuteReader(CommandBehavior.CloseConnection) If dr.HasRows While dr.Read If Not IsDBNull(dr.Item("KPIPOSTCODE")) Then cboPosition.Items.Add(dr.Item("KPIPOSTCODE")) End If End … | |
Re: When you use LEFT JOIN, only those records from that table that matches are included and therefore counted. Perhaps this could be useful: [URL="http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html"]http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html[/URL] | |
Re: You need to encase All values in it's own single-quote and separate each column->value with a comma. [ICODE]UPDATE table SET col1 = 'value1', col2 = 'value2' WHERE col3 = 'value3'[/ICODE] | |
Re: Try replacing some of the code with this: [CODE] Dim cn As New System.Data.SqlClient.SqlConnection("your connectionstring") cn.Open() Dim getUser As New System.Data.SqlClient.SqlCommand("select Username from MegaUsers where username=?", cn) getUser.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Username", strmegaun)) Dim resultsReader As System.Data.SqlClient.SqlDataReader resultsReader = getUser.ExecuteReader(CommandBehavior.CloseConnection) If resultsReader.HasRows Then While resultsReader.Read() Response.Write(resultsReader("Username").ToString()) End While End If resultsReader.Close() resultsReader = … | |
Re: Most likely problem lies within the DownloadFile method. Perhaps it's the WebClient that doesn't have access to the file your'e trying to download. Try adding some credentials to the client. [CODE] Dim cli As System.Net.WebClient cli.Credentials = New System.Net.NetworkCredential("username", "password") cli.DownloadFile("url to file", "local file") [/CODE] | |
Re: See what happens if you add the lines in red. [code] WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1) [COLOR="red"]Webbrowser1.Document.InvokeScript("modified('body_plain',true)")[/COLOR] WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords) [COLOR="Red"]Webbrowser1.Document.InvokeScript("modified('keywords')")[/COLOR] [/code] | |
Re: If the items in the three listboxes share the same index, you can use the SelectedIndex property. [CODE] If listbox2.SelectedIndex > -1 Then listbox1.SelectedIndex = listbox2.SelectedIndex listbox3.SelectedIndex = listbox2.SelectedIndex End If [/CODE] | |
Re: And likewise, you can also recieve mail through the same classes. Take a look at the SmtpClient class. | |
Re: Add and change the code in red. [CODE]Public Class MainForm [COLOR="Red"]Private intRetry As Integer = 0[/COLOR] Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click Me.Close() End Sub Private Sub PasswordTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PasswordTextBox.Enter PasswordTextBox.SelectAll() End Sub Private Sub PasswordTextBox_TextChanged(ByVal sender … | |
Re: [ICODE] Select R.*, P.HphoneNum, P.HeirHpNum from PendingReport R [COLOR="Red"]INNER JOIN[/COLOR] PatientTable P [COLOR="red"]ON[/COLOR] P.PatientID = R.PatientID [/ICODE] | |
![]() | Re: Doesn't this all depends on how you place your monitors? One monitor is always the primary depending on which graphics port you use on your computer. In either case, perhaps you should take a look at the Screen class? More specifically the property AllScreens which contains a collection of all … ![]() |
Re: [CODE] Dim htmlElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input") For Each el As HtmlElement In htmlElements If el.GetAttribute("name").Equals("sample") Then TextBox.Text = el.GetAttribute("value") End If Next [/CODE] | |
Re: [CODE] Dim FontName As String = "Arial" Dim FontSize As Integer = 14 Dim FS As New Font(FontName, FontSize, FontStyle.Regular) Me.Font = FS [/CODE] | |
Re: Perhaps something like this: [CODE] If txtSearch.Text.Equals("") Then PurchaseDt.DefaultView.RowFilter = "" Else PurchaseDt.DefaultView.RowFilter = "PUrchaseID=" & Integer.Parse(txtSearch.Text) End If [/CODE] | |
Re: [QUOTE=Lee21;1181957]Guyz I need help.. I'm a newbie in vb.net 2008..I have a form for User Account Maintenance and I want to transfer the Data of the specified Cell of the Datagridview once it's selected by clicking the mouse. How can I transfer it to textbox? Please help me.[/QUOTE] DataGridView has … | |
Re: Is the Access database local on you machine or is it placed on a network share? If it's local then you need to include the .MDB file in the deployment project so that it too is copied along with your application. What tool are you using to create a setup? | |
Re: First. If you are using a Primary Key in Access 2000, then you don't need to provide that in your INSERT statement. Access 2000 automatically adds a new record with a new Primary Key value. That makes all the records in the database unique. Second. There is probably a very … | |
Re: Create a new Class Library project. Then add a reference to System.Windows.Forms. Now you're free to add and design windows forms to that project. Compile. In your current project, add a reference to the newly compiled Class Library binary (dll) and you can call methods and show forms as usual. | |
Re: [QUOTE] created a login system that works quite well, but I need using the db or settings or a variable keep the logged in staffid and username constant on all the forms through out the forms. I have no idea how to do this. as it is information that in … | |
Re: As you probably know, viruses is not always a separate file with a file-extension but is mostly a part of an existing file on your computer as an "intruder". That said, take a look at this threat database: [URL="http://vil.nai.com/vil/default.aspx"]http://vil.nai.com/vil/default.aspx[/URL]. Here you can find almost(?) all known viruses with their name … |
The End.