646 Posted Topics
Re: You're probably using ASP.NET, but with old classic ASP I would reset "login count"-session back to zero after the message box has been shown: [ICODE]Session("LoginCount") = 0[/ICODE]. Now the user would have three login attempts again. | |
Re: Do you have two picture boxes? There wasn't anything in your code about picture boxes or images? Use only one picture box and load the image you need [CODE=VB.NET] Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage End Sub Private Sub Button1_Click(ByVal … | |
Re: You didn't post the actual code you're using, right? You're probably doing something like this [CODE=VB.NET]Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus ' Dim strUserName As String strUserName = Environment.GetEnvironmentVariable("USERNAME") TextBox1.Text = Convert.ToString(strUserName) End Sub[/CODE] Change it to [CODE=VB.NET]Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal … | |
Re: [CODE=VB.NET]Dim namearray() As String Dim NewName As String Dim i As Integer i = 0 NewName = InputBox("Enter the candidates name:", "candidatename", "", 500, 500) Do Until String.IsNullOrEmpty(NewName) ReDim Preserve namearray(i) namearray(i) = NewName i += 1 NewName = InputBox("Enter the candidates name:", "candidatename", "", 500, 500) Loop[/CODE]Loops until you … | |
Re: [QUOTE]took a quick, very quick look. to add the condition you need to finish the WHERE cmd = New OleDbCommand("SELECT * from UMP WHERE ", cn) 'to cmd = New OleDbCommand("SELECT * from UMP WHERE field like " & txtbox.text & "%", cn)[/QUOTE] Here's a one more correction. Single quotes … | |
Re: And how's that answer related to the question? | |
Re: Is [ICODE]prcConnect[/ICODE] called before [ICODE]cmdSave_Click[/ICODE]? If so, close the connection[CODE=VB.NET] Try strCon = "provider=SQLOLEDB;User id=" & U & ";Password=" & P & ";Server=" & S & ";database=" & D Con = New System.Data.OleDb.OleDbConnection(strCon) Con.Open() MsgBox("Connection to the Database is Successful", MsgBoxStyle.Information, "Welcome") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error Connecting … | |
Re: Something like that your code does seems to do. And what is the question? | |
Re: Here's the basic idea you're looking for [CODE=VB.NET]Private m_ViewState As Boolean Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' If m_ViewState Then DataGridView1.Visible = True DataGridView1.Enabled = True ' Hide label(s) Label1.Visible = False Else DataGridView1.Visible = False DataGridView1.Enabled = False ' Show label(s) Label1.Visible … | |
Re: If you have to include some additional files, I think the easiest way to "publish" is to compile and create an installation package. Before compiling, check from the "Build\Configuration Manager"-menu that you have "Active solution configuration" set to "Release". Then build the solution, take the exe-file [B]and[/B] possible dll-files from … | |
Re: Here's a sample [CODE=VB.NET]Dim oCon As OdbcConnection Dim oCmd As OdbcCommand Dim ConnStr As String Dim strSQL As String ConnStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=<path to mdb file>" oCon = New OdbcConnection(ConnStr) oCon.Open() oCmd = oCon.CreateCommand() strSQL = "INSERT INTO <tablename> (<fieldname>) VALUES ('" & TextBox1.Text.Replace("'", "''") & "')" oCmd.CommandText = strSQL … | |
Re: Here you have [CODE=VB.NET]OpenFileDialog1.CheckFileExists = True OpenFileDialog1.CheckPathExists = True OpenFileDialog1.DefaultExt = "txt" OpenFileDialog1.FileName = "" OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" OpenFileDialog1.Multiselect = False If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName) End If[/CODE]By the way, I gave this snippet to you already? | |
Re: [QUOTE]when i use evententry.category.tostring it just displays a number.[/QUOTE] What number do you get? If you get "0" (or "(0)") then the category is "None". Have you checked with Event Viewer app what category names you should get? This is the "basic" code to dump event log [CODE=VB.NET]Dim oEvLog As … | |
Re: You may also use String.Join which is very fast compared to loop + append. For example, lines [CODE=VB.NET]For x As Integer = 0 To endLine - 1 RichTextBox1.Text &= Document.Lines(x) & vbNewLine J = x Next [/CODE]can be replaced with [CODE=VB.NET]RichTextBox1.Text = String.Join(vbNewLine, Document.Lines) ' or RichTextBox1.Text = String.Join(vbNewLine, Document.Lines, … | |
Re: I found [URL="http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/53c2de93-ab33-41d0-b5dd-7ca5fbfa5c24/"]this[/URL] thread from the MSDN forums. A few had the error solved and if I got it right, the problem arises from mixing different .NET versions, like 2.0 and 3.5. Hope you get some help from this. | |
Re: [QUOTE]How can I make the DataGrid increments the RecID automatically?[/QUOTE] Since that is an identity column you shouldn't do anything as it's value should be generated (i.e. incremented) automatically. I would re-check that it's defined as: [RecID] [int] IDENTITY(1,1) NOT NULL assuming its int-type field. | |
Re: Yes, this is a wrong forum :) That file does not seem to be available for download by itself. A few things to try - who did that program originally? Does the company still exists? If it does, ask them for the file(s) - try to find another VB4 program … | |
Re: Didn't check if VB.NET 2003 supports all these features, but here's the code [CODE=VB.NET]OpenFileDialog1.CheckFileExists = True OpenFileDialog1.CheckPathExists = True OpenFileDialog1.DefaultExt = "txt" OpenFileDialog1.FileName = "" OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" OpenFileDialog1.Multiselect = False If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName) End If[/CODE]And I suggest starting a new … | |
Re: See [URL="http://msdn.microsoft.com/en-us/library/aa394515.aspx"]Win32_Volume Class[/URL]. It is not supported in WinXP. | |
Re: Tab-control is supposed to work by user selecting any tab he or she wants to and in any order he/she wants to select it. This is not to say that your approach is "wrong". But like you noticed you ended up thinking about using IMessageFilter.PreFilterMessage. If your not familiar with … | |
Re: First, this is Visual Basic 4 / 5 / 6 i.e. classic VB forum. You're question is about VB.NET which has it's own [URL="http://www.daniweb.com/forums/forum58.html"]forum[/URL] here in DaniWeb. WebBrowser1.Focus() sets the focus to the webbrowser control but there's [B]no[/B] guarantee where the focus is in the web page its displaying. Anyway, … | |
Re: You have problem with saving/loading text files, right? I tested your save-code: [CODE=VB.NET]Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' Dim mydoclocation As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments Dim TempPath As String TempPath = mydoclocation & "c:\cat4\text.txt" Debug.Print(TempPath) 'RichTextBox1.SaveFile(TempPath, RichTextBoxStreamType.PlainText) End Sub[/CODE]and the result was [ICODE]"C:\Documents and … | |
Re: Here's a fixed code (at least works in my comp): [CODE=VBNET]dim Wsh dim objEnv dim windir dim Uname set wsh = WScript.createobject("WScript.Shell") set objEnv = wsh.environment("Process") windir = objEnv("Windir") uname = inputbox("Enter The Name") wsh.run windir & "\system32\RUNAS.exe /profile /user:" & Uname & " /savecred " & """C:\Program Files\Skype\Phone\Skype.exe""", 1, … | |
Re: Lets combine what SCBWV wrote and arrays for "linking". Use arrays to hold names in combo box(es) and actual filepaths [CODE=VB6]Private InstNames() As String Private InstPaths() As String Private Sub Form_Load() ' ReDim InstNames(1) ReDim InstPaths(1) InstNames(0) = "MyApp" InstPaths(0) = "C:\Installers\file.msi" Combo1.AddItem InstNames(0) End Sub Private Sub Command1_Click() ' … | |
Re: First, you never ever connect to a database file (*.mdf) directly. You connect to the database, which knows where it's files are and handles them. I didn't have a good (simple) example how to connect to the SQL Server. So I'll give you few links to get started. First you'll … | |
Re: You're talking about DB table, right? Assuming you have mobile phone numbers in a "unified format", this SQL statement returns unique numbers and their count: [CODE]SELECT DISTINCT(<MobileNumberField>), COUNT(<MobileNumberField>) AS MobileNumberCount FROM <tablename> GROUP BY <MobileNumberField>[/CODE] Just replace field and table names before you use that. | |
Re: There's at least one syntax error in the SQL: [ICODE]sqlCmd.CommandText = "insert into SystemData (SystemName) Values(" & myhostnameDescription & ");"[/ICODE] should be [ICODE]sqlCmd.CommandText = "insert into SystemData (SystemName) Values('" & myhostnameDescription & "');"[/ICODE]i.e. a string has to have single quotes around it. | |
Re: See [URL="http://msdn.microsoft.com/en-us/library/ms190501(SQL.90).aspx"]OLE Automation Stored Procedures[/URL] from MSDN Library. | |
Re: You mean adding sheets to an existing Excel file, right? Yes it's possible. But I think the Excel file will be "locked" to first user until he/she closes it. AFAIK multiple users writing to the same Excel [B]simultaneously[/B] is not possible. | |
Re: See [URL="http://www.velocityreviews.com/forums/t69974-strange-problem-with-systemnetsocketstcpclient.html"]ASP Net - Strange problem with System.Net.Sockets.TcpClient()[/URL]. There's the same problem solved. The point is to read data in a small blocks in a loop to a buffer, and to check how many bytes you've received in each loop. After all the data is read, convert byte buffer to … | |
Re: Was your toolbar based on WinForms ToolBar control? Here's a very simplified example which uses ToolBar control with two ToolStripButton controls, just to show the idea. First the user control itself [CODE=VB.NET]Public Class UserControl1 Public Event AddClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Public Event EditClick(ByVal sender As System.Object, … | |
Mozilla Thunderbird offers a very handy "Copy Link Location" option which copies a http-link from an email to the clipboard. For some reason Outlook (XP/2002) does not have this feature. When I right-click a link in the email, I have to select "View Source", open the email's source (HTML) to … | |
Re: In the DataGridView control indices start from 0, so I've used 0 instead of 1. You can trap CellClick event handler [CODE=VB.NET]Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick ' If e.ColumnIndex = 0 AndAlso e.RowIndex = 0 Then ' User clicked Col0 and Row0 End … | |
Re: It seems that [ICODE]form2.list2.ContextMenuStrip[/ICODE] references to the list in form1. Create a copy of the [ICODE]form1.cmenu[/ICODE] I didn't fully test this but it should be very easy to do:[CODE=VB.NET] Dim ArrItems() As ToolStripMenuItem ReDim ArrItems(form1.cmenu.Items.Count - 1) form1.cmenu.Items.CopyTo(ArrItems, 0) form2.list2.ContextMenuStrip.Items.AddRange(ArrItems)[/CODE] | |
Re: What is your "data report" and the DB where the data comes from? | |
Re: Do you want to show HTML in the browser application or with .NET's web browser control? In the first case, you'll have to save HTML code to a file. In the latter case i.e. your VB.NET application shows the page with web browser control, you do not have to create … | |
Re: Here's two solutions to save a file [CODE=VB.NET]Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click ' SaveFileDialog1.AddExtension = True SaveFileDialog1.CheckPathExists = True SaveFileDialog1.DefaultExt = "mdb" SaveFileDialog1.FileName = "D:\BlogTest.mdb" ' Put here the filename SaveFileDialog1.Filter = "MS Access Files (*.mdb)|*.mdb" 'SaveFileDialog1.InitialDirectory = "<set initial folder if needed>" … | |
Re: A treeview control shows items hierarchically. If you remove (there's no visible property in the node items) a node, have you thought what to do with the possible child nodes? After you've figured that out, loop the nodes and remove non-matching nodes with [ICODE]TreeView1.Nodes.Remove[/ICODE] method. If you want some "find" … | |
Re: Yes, a bit confusing. Without seeing the "big picture", I would allow user make the selection criteria in the first form. When user presses the button I would build a new SQL select statement with selection criteria, open the data form and show whatever was returned from the SQL statement. … | |
Re: Submit or Ok-button is the proper place to validate input. Since you have many things to validate, I would use a separate function: [CODE=VB6] Private Function ValidateForm() As Boolean ' Validate form fields If cname.Text = "" Or empname2.Text = "" Or reason2.Text = "" Or days2.Text = "" Or … | |
Re: Here's a sample how to work with arrays [CODE=VB.NET]Private VoteArray() As Integer ' Array for items (integers in this case) Private Const VOTE_ARRY_SIZE As Integer = 3 ' Number of items in the array ' A help variable to hold "voted number" Private Voted As Integer Private Sub Form1_Load(ByVal sender … | |
Re: You change the current tab page from the tab control [CODE=VB.NET]Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' TabControl1.SelectedIndex = 1 End Sub[/CODE] shows the second tab page. | |
Re: There's no RENAME in SQL. AFAIK the only way to rename field name in Access table is to first DROP field then add field (ALTER). With SQL Server you can rename fields with a stored procedure. So the options left are: 1) change the field name manually 2) leave the … | |
Re: Normal buttons require ALT-key to be pressed. If you don't mind this, name the buttons [CODE=VB.NET] Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Button1.Text = "&1" Button2.Text = "&2" End Sub[/CODE] and trap "number"-buttons [CODE=VB.NET] Private Sub Button1_Click(ByVal sender As Object, ByVal e As … | |
Re: No, it's not possible. [CODE=VB6]If tCommand$ end if[/CODE] is not a valid statement in VB6 so you can't get the code through the compiler. Neither [CODE=VB6]tCommand = ".width <= 36" If tCommand$ Then wqty = 1 Else wqty = 2 end if[/CODE] works because Visual Basic does not have any … | |
Re: You may find My.Computer.FileSystem very useful. It has methods for FileCopy, FileExists and GetFileInfo, which in turn provides Length and Extension of the file. A few scenarios where the "copy file"-code above does not work: - "C:\Temp\myfile" (no extension) - "C:\foo.bar\myfile" (dot in the path) - "C:\Temp\.myfile" (dot as the … | |
Re: I haven't worked much with old COM components with VB.NET. Have you tried to add a references from the VB.NET project directly to the COM component? VB.NET creates a "COM wrapper" for the component and you should see it in the Object Browser similar to: add reference to Windows Media … | |
Re: Check that 1) SDF-file is really installed i.e. copied during installation 2) check your connection string. See [URL="http://connectionstrings.com/sql-server-2005-ce"]Connection strings for SQL Server Compact Edition[/URL]. Make sure your Data Source points to the SDF-file, which is installed by your customer (or the installer to be more precise). There may be just … | |
Re: I don't see anything wrong in how you save checkbox's checked state to DB. You do read this information back in to the form, right? You may have some error in how you read and set checkbox's state. | |
Re: You seem to have a syntax error in the SQL clause, it should be [CODE=SQL]UPDATE Names SET name = @p1, Address = @p2 WHERE Name = @p3 AND Address = @p4[/CODE] |
The End.