646 Posted Topics
Re: System.DateTime.Now returns current date (and time). You could validate dob in following way [CODE=VB.NET]Dim MinDate As Date Dim dob As Date MinDate = CDate("1.1.2008") dob = CDate(MaskedTextBox1.Text) ' Check that dob is between MinDate and Now() If MinDate <= dob AndAlso dob <= System.DateTime.Now Then ' Dob is valid Else … | |
Re: I won't guarantee that this code is bullet-proof, but give it a try: [CODE=VB.NET]Dim TempStr As String Dim i As Integer Const DIGITS As String = "0123456789" TempStr = TextBox1.Text ' Strip to only digits. There may be a better way to remove non-digits off Do Until String.IsNullOrEmpty(TempStr) For i … | |
Re: What exactly is your question? I would change SQL to: [CODE]"Select Distinct * From IDM_IDEA_USERS, IDM_IDEA_AUTHORIZED_USERS Where IDM_IDEA_USERS.USER_ID=? and IDM_IDEA_USERS.PASSWORD=? and IDM_IDEA_USERS.SAP_ID = IDM_IDEA_AUTHORIZED_USERS.SAP_ID"[/CODE] also, instead of "?"-characters you should have @p1 and @p2. I think, I didn't checked :) | |
Re: Use [CODE]form.ShowDialog[/CODE] to open second form. | |
Re: Here's a link to test for a valid email address with regular expression: [URL="http://www.vbforums.com/showthread.php?t=407441"]http://www.vbforums.com/showthread.php?t=407441[/URL] and you should also check: [URL="http://www.regular-expressions.info/email.html"]http://www.regular-expressions.info/email.html[/URL] and you'll notice that there's not any bullet-proof method to test email address validity. Manal answered your first question, but here's a slightly improved version: [CODE=VB.NET]If String.IsNullOrEmpty(installment1.Text) Then ' Empty … | |
Re: [QUOTE]I heard that XML can be used in the replacement of our databases...Is it right???[/QUOTE] Not quite. XML is just a file-based text file after all. But you can do with XML (or XML code libraries) same things: get/put/update/delete data. [QUOTE]What is the purpose of XML to be used in … | |
Re: Month has to be in upper case: [CODE=VB6]DTPicker1.Format = dtpCustom DTPicker1.CustomFormat = "dd/MM/yyyy"[/CODE] | |
Re: Fix [QUOTE]'Split ALineIn into the array Fields Fields = ALineIn.Split(Delimiter, 9)[/QUOTE] to [ICODE]Fields = Strings.Split(ALineIn, Delimiter, 9)[/ICODE] or declare Delimiter as an array: [CODE=VB.NET]Dim Delimiter(0) As String Delimiter(0) = Convert.ToChar(ControlChars.Tab) ' Or Convert.ToChar(9) Fields = ALineIn.Split(Delimiter, 9, StringSplitOptions.None) ' Or StringSplitOptions.RemoveEmptyEntries [/CODE] | |
Re: Now, where's your XML? Anyway, first make a function to test "Is Bigger Than x" [CODE=VB.NET]Public Function IsBigger(ByVal OneLine As String, ByVal x As Integer) As Boolean ' Dim TempStr As String If OneLine.Length >= 10 Then TempStr = OneLine.Substring(0, 10) Try Value = CInt(TempStr) If Value > x Then … | |
Re: SalespersonID is INT, remove quotes: [CODE=VB.NET]Dim sqlWrite As String = "INSERT INTO Audit (Time, Date, SalespersonID) VALUES('" & CType(lblTime.Text, String) & "','" & CType(lblDate.Text, String) & "'," & SalespersonID & ")" da = New OleDb.OleDbCommand(sqlWrite, Databaseconnection) Dim temp_num As Integer temp_num = da.ExecuteNonQuery()[/CODE] Use quotes only with textual and datetime … | |
Re: Probably the only way is to maintain reference to document: [CODE=VB.NET]Dim DocInstance1 As Word.Document Dim DocInstance2 As Word.Document DocInstance1 = objWord.Documents.Open("D:\a.doc") objWord.Visible = True DocInstance2 = objWord.Documents.Open("D:\b.doc") objWord.Visible = True[/CODE] And then close the unneeded instance when the wanted condition is met: [ICODE]DocInstance1.Close()[/ICODE] Of course, instances should be in array … | |
Re: If you do not want to block application execution, use Timer control: [CODE=VB.NET]Timer1.Interval = 10000 Timer1.Start() Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick My.Computer.FileSystem.DeleteFile("<file to delete>") End Sub[/CODE] If you can block your application execution: [CODE=VB.NET]Threading.Thread.Sleep(10000) My.Computer.FileSystem.DeleteFile("<file to delete>")[/CODE] In both cases the delay is … | |
Re: Using XML files is not that difficult. If you want to try XML [URL="http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=258"]here's[/URL] a simple code how to modify XML file. And [URL="http://www.builderau.com.au/program/vb/soa/Easily-navigate-XML-with-VB-NET-and-XPath/0,339028462,320275387,00.htm"]this article[/URL] shows how to read/search XML file with XPath. You'll also get the idea, how to structure connection string parts in XML file. But how about … | |
Re: Here are two ways: With SelectedIndex property: [ICODE]TabControl1.SelectedIndex = 1[/ICODE] Tab pages are indexed from 0, 1, 2 ... With SelectedTab property: [ICODE]TabControl1.SelectedTab = TabControl1.TabPages.Item("TabPage2")[/ICODE] assuming you have a tab page named "TabPage2", or [ICODE]TabControl1.SelectedTab = TabControl1.TabPages.Item(1)[/ICODE] and the same indexing applies as with SelectedIndex property. | |
Re: I didn't test this but if I remember right the syntax goes: [CODE=VB.NET]Imports System.Data.OleDb Dim strSQL As String Dim oConn As OleDb.OleDbConnection Dim oCmd As OleDb.OleDbCommand oConn = New OleDb.OleDbConnection("<connection string>") strSQL = "ALTER TABLE <table name> ALTER COLUMN FPC_Code CONSTRAINT FPC_Code_PK PRIMARY KEY" oCmd = New OleDb.OleDbCommand(strSQL, oConn) oCmd.ExecuteNonQuery()[/CODE] … | |
Re: Here you are: [CODE=VB.NET]Private Sub cmdSlideShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSlideShow.Click Dim x As Integer With ComboBox1 For x = 0 To (.Items.Count) - 1 labFile.Text = .Items(x).ToString PictureBox1.Image = Image.FromFile(.Items(x).ToString) My.Application.DoEvents() Threading.Thread.Sleep(CInt(TimeSpan.FromSeconds(5).TotalMilliseconds)) Next x End With End Sub[/CODE] For some reason [ICODE]PictureBox1.ImageLocation = .Items(x).ToString[/ICODE] didn't … | |
Re: Most DBs support Image or Binary datatype which you can use with images. First you have to convert image to bytes. Here's a sample code in my blog: [URL="http://windevblog.blogspot.com/2008/08/convert-image-to-byte-array-and-vice.html"]Convert image to byte array and vice versa[/URL] and then store bytes to DB. This sample code uses SQL Server but the … | |
Re: You should handle SelectedIndexChanged event for cboDept and cboTeamNames too. If I understand this right, you have an organization hierarchy (dept -> sect -> team) So, I would use something like this (in pseudo-code): [CODE]Private Sub cboDept_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboDept.SelectedIndexChanged << User selected Dept, … | |
Re: No. No problem. The syntax is: [CODE=VB6]ColumnHeaders.Add([Index], [Key], [Text], [Width], [Alignment], [Icon])[/CODE] so your code leaves Index and Key to default values and gives Text and Width values. And that's correct. What was the exact error message? Do you have variable Header1 Dimmed somewhere? | |
Re: Do you mean something like this: [CODE=VB.NET]' Get current date Label1.Text = System.DateTime.Now.ToString ' User enters number of days in the TextBox. Lets say 8 days TextBox1.Text = "8" ' Now calculate date for DateTimePicker DateTimePicker1.Value = CDate(Label1.Text).AddDays(CInt(TextBox1.Text))[/CODE] And now the DatetimePicker shows: "1. October 2008" (exact format depends on … | |
Re: Nothing to do with Visual Basic. That's JavaScript. Anyway, it writes a HTML header tag. Variable i should be from 1 to 6 and the output would be following HTML snippet if i = 3: [CODE=HTML]<h3>This is header 3</h3>[/CODE] | |
Re: Are you having issue with creating classes themselves or creating [U]instances[/U] from the classes? | |
Re: Binary (and Varbinary) store binary data in binary format, not digits. I would suggest using Char (or Varchar) types to store zip codes. Yes, you could use Binary type to store 5 digit numbers from 0 to 99999, but this requires 17 bits. And since Binary type is allocated per … | |
Re: You can't enable/disable tab pages in any simple way. There are some workarounds you could try. Remove tab page: [CODE=VB.NET]TabControl1.TabPages.RemoveByKey("TabPage1")[/CODE] If you need to "enable" it later, save it first: [CODE=VB.NET]Dim MyTabPage As TabPage MyTabPage = TabControl1.TabPages.Item("TabPage1") TabControl1.TabPages.RemoveByKey("TabPage1")[/CODE] however, I didn't test this if it works. Disable controls in the … | |
Re: The best way to get started is to do some googling. Reading XML files: [URL="http://www.google.com/search?q=VB.NET+read+XML+file"]http://www.google.com/search?q=VB.NET+read+XML+file[/URL] writing XML files: [URL="http://www.google.com/search?q=VB.NET+write+XML+file"]http://www.google.com/search?q=VB.NET+write+XML+file[/URL] and .NET Framework's XML reference: [URL="http://msdn.microsoft.com/en-us/library/2bcctyt8.aspx"]http://msdn.microsoft.com/en-us/library/2bcctyt8.aspx[/URL] You'll find a plenty of example codes. | |
Re: Do you store the file path in your combo box? Like this: [CODE]ComboBox1.Items.Clear() ComboBox1.Items.Add("D:\Download\Image1.jpg") ComboBox1.Items.Add("D:\Download\Image2.jpg")[/CODE] then you get the image with: [CODE]Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged ' ' Load picture from the file Try PictureBox1.Image = Image.FromFile(ComboBox1.SelectedItem.ToString) Catch ex As Exception ' Handle … | |
Re: There are a few points that could cause error: - change [CODE]Dim rs As adodb.Recordset[/CODE] to [CODE]Dim rs As New adodb.Recordset[/CODE] - make sure that CN is not nothing eg. you do have a valid connection object - your query may return empty recordset. Haven't dealed with these for a … | |
Re: You get screen's height with: [CODE]Dim DisplayRect As Rectangle DisplayRect = Screen.PrimaryScreen.Bounds MessageBox.Show("Screen Height=" & DisplayRect.Height, "Height", MessageBoxButtons.OK, MessageBoxIcon.Information)[/CODE] and the usable area (without Taskbar): [CODE]Dim ScreenRect As Rectangle ScreenRect = My.Computer.Screen.WorkingArea MessageBox.Show("WorkingArea Height=" & ScreenRect.Height, "Height", MessageBoxButtons.OK, MessageBoxIcon.Information)[/CODE] I didn't quite understand your question. If possible, forget screen resolutions, … | |
Re: [CODE] If inputSales <> "" Then totalSales = totalSales + inputSales End If [/CODE] and then show average: [CODE]MessageBox.Show(average, averageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)[/CODE] Hope this makes you happy (and your professor) ;) | |
Re: VS does that sometimes. Locate your web.config file and compilation-line which looks something like below: [CODE]<compilation debug="false" strict="false" explicit="true"/>[/CODE] if you have debug="false", change it to debug="true" | |
Re: [QUOTE=aks87;692977]I need to copy data from one excel sheet to another. source sheet 1 2 3 4 5 6 the data is to be copied in the following format 1 2 3 4 5 6 the copy paste method does not allow this because the regions are different. Can this … | |
Re: You are adding your ICO-file in the right way, but the file is not in Windows ICO-format. I don't know much about PhotoShop. If it has a possibility to save ICO-files, try it. If that doesn't work, save your picture as a GIF-file with transparent background. Then download, for example, … | |
Re: You tried Dnx's advice: [CODE=VB.NET]p = New Process p.StartInfo.FileName = "C:\Windows\System32\Notepad.exe" p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden p.Start() [/CODE] The (Notepad) exe is not visible in the taskbar, if that's what you want. Of course it's still visible in Task Manager. Do you want to hide it in Task Manager too? If you … | |
Re: Check your XML if you have a node like <x:y></x:y>, this will cause the error message. Sorry for not giving a more precise solution to your question. However, I found this link [URL="http://forums.asp.net/p/1290528/2492013.aspx"]http://forums.asp.net/p/1290528/2492013.aspx[/URL] you may find a better answer from that. | |
Re: Use ByRef to get something from the sub: [CODE=VB]Sub CheckLetter(ByVal character As String, ByRef isletter As Boolean)[/CODE] or change sub to function: [CODE=VB] Function CheckLetter(ByVal character As String) As Boolean Dim asciichar As Integer asciichar = Asc(character) If asciichar >= 97 And asciichar <= 122 Then CheckLetter = True Else … | |
Re: You're using GeckoFX, right? I'm not familiar with it myself. Was there any documentation with GeckoFX download? You may want to search GeckoFX forum at [URL="http://forum.skybound.ca/index.php?board=6.0"]http://forum.skybound.ca/index.php?board=6.0[/URL] or perhaps register and ask your questions there. I'm assuming "pagetab" control is part of GeckoFX and not VB's TabControl. | |
Re: Have you ever tried googling? [URL="http://www.google.com/search?q=VB.NET+%22SQL+Server%22+connect"]http://www.google.com/search?q=VB.NET+%22SQL+Server%22+connect[/URL] gave a plenty of examples. | |
Re: You should increase number-variable in For Next loop like this: [CODE]For intCounter = 1 To 10 TextBox2.Text = number & wrap number += 1 Next intCounter[/CODE] | |
Re: You are calling function with an empty string which causes that error in [ICODE]oldString.Substring(0, 1)[/ICODE] You should check for an empty string first: [CODE=VB.NET]Function uppercasefirstletter(ByVal oldString As String) As String ' If String.IsNullOrEmpty(oldString) Then Return oldString Else Return oldString.Substring(0, 1).ToUpper & oldString.Substring(1, oldString.Length - 1) End If End Function[/CODE] | |
Re: [CODE]Dim DONDTheme As String = "C:\DOND\bin\Debug\dond.wav" My.Computer.Audio.Play(DONDTheme, AudioPlayMode.BackgroundLoop)[/CODE] And call [ICODE]My.Computer.Audio.Stop()[/ICODE] to stop looping. | |
Re: You send the string as a ByVal parameter and get result as ByRef parameters. Use Split function to separate numbers (integers in this case). Here is a sample: [CODE]Private Sub Splitter(ByVal InputStr As String, ByRef Num1 As Integer, ByRef Num2 As Integer, ByRef Num3 As Integer) ' Dim SplittedArr() As … | |
Re: Have you tried GeckoFX: [url]http://www.skybound.ca/projects/[/url] | |
Re: Excel uses Visual Basic for Applications which is not the same as VB. You will find plenty of free online tutorials with Google: [URL="http://www.google.com/search?q=VBA+tutorial+excel"]http://www.google.com/search?q=VBA+tutorial+excel[/URL] It's impossible for me to say how long the learning will take :) You may also try out Excel's macro recording and then check the code … | |
Re: It seems that picCanvas.Image is nothing (your code probably works fine until you refer to Image object). You can test that: [CODE]If picCanvas.Image Is Nothing Then MessageBox.Show("No image object", "Error", MessageBoxButtons.OK) Else picCanvas.Image.Save("C:\img.png", Imaging.ImageFormat.Png) End If [/CODE] If this is the case, initialize PictureBoxes Image object: [CODE]picCanvas.Image = Image.FromFile("C:\MyCanvas.png")[/CODE] If … | |
Re: Here's a snippet that "simulates" maximizing form: [CODE]Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None ' Do not maximize Me.WindowState = FormWindowState.Normal ' Set location to upper left corner Me.Location = New Point(0, 0) ' Resize so that the taskbar etc. stays visible Me.Size = My.Computer.Screen.WorkingArea.Size[/CODE] | |
Re: Declare your picture box first [CODE]Dim picCanvas2 As PictureBox If picCanvas2 Is Nothing Then picCanvas2 = New PictureBox AddHandler picCanvas2.MouseDown, AddressOf picCanvas2_MouseDown Else End If[/CODE] of course you have to set picCanvas2's size, position etc. properties too. |
The End.