646 Posted Topics

Member Avatar for laghaterohan

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 …

Member Avatar for laghaterohan
0
1K
Member Avatar for liquoriser21

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 …

Member Avatar for liquoriser21
0
192
Member Avatar for MadAxel

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 :)

Member Avatar for MadAxel
0
76
Member Avatar for stepcicc
Member Avatar for laghaterohan

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 …

Member Avatar for laghaterohan
0
171
Member Avatar for Shanti C

[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 …

Member Avatar for Shanti C
0
102
Member Avatar for abu taher

Month has to be in upper case: [CODE=VB6]DTPicker1.Format = dtpCustom DTPicker1.CustomFormat = "dd/MM/yyyy"[/CODE]

Member Avatar for Teme64
0
201
Member Avatar for Birdie010

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]

Member Avatar for Teme64
0
122
Member Avatar for numlock

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 …

Member Avatar for Teme64
0
89
Member Avatar for shuey79

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 …

Member Avatar for shuey79
0
328
Member Avatar for spinnaret

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 …

Member Avatar for Teme64
0
84
Member Avatar for spinnaret

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 …

Member Avatar for Teme64
0
101
Member Avatar for LudwigFF

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 …

Member Avatar for Teme64
0
102
Member Avatar for mailtosridar

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.

Member Avatar for Teme64
0
53
Member Avatar for isaackhazi

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] …

Member Avatar for isaackhazi
0
543
Member Avatar for Sheryl99

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 …

Member Avatar for Sheryl99
0
89
Member Avatar for mailtosridar

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 …

Member Avatar for Jx_Man
0
275
Member Avatar for MadAxel

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, …

Member Avatar for MadAxel
0
117
Member Avatar for ShaneLewis702

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?

Member Avatar for Teme64
0
131
Member Avatar for smile4evr

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 …

Member Avatar for smile4evr
0
112
Member Avatar for ruby.n

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]

Member Avatar for techtix
0
69
Member Avatar for juma denice

Are you having issue with creating classes themselves or creating [U]instances[/U] from the classes?

Member Avatar for Teme64
0
37
Member Avatar for Duki

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 …

Member Avatar for Teme64
0
96
Member Avatar for laghaterohan

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 …

Member Avatar for Teme64
0
93
Member Avatar for J-P

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.

Member Avatar for Teme64
0
104
Member Avatar for asmit1987

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 …

Member Avatar for Teme64
0
2K
Member Avatar for smile4evr

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 …

Member Avatar for smile4evr
0
96
Member Avatar for Eswar.P

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, …

Member Avatar for Teme64
0
100
Member Avatar for bpacheco1227

[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) ;)

Member Avatar for bpacheco1227
0
215
Member Avatar for csharpdeveloper

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"

Member Avatar for Teme64
0
119
Member Avatar for aks87

[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 …

Member Avatar for aks87
0
95
Member Avatar for vbcoder123456

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, …

Member Avatar for dickersonka
0
153
Member Avatar for tusharvichare

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 …

Member Avatar for Teme64
0
253
Member Avatar for pbbhatt

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.

Member Avatar for Teme64
0
97
Member Avatar for jem00

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 …

Member Avatar for Teme64
0
116
Member Avatar for Mr Brownstone

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.

Member Avatar for Teme64
0
110
Member Avatar for etenge

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.

Member Avatar for Alexpap
0
112
Member Avatar for bpacheco1227

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]

Member Avatar for bpacheco1227
0
83
Member Avatar for laghaterohan

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]

Member Avatar for laghaterohan
0
86
Member Avatar for Lee_Sonnenburg

[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.

Member Avatar for Lee_Sonnenburg
0
167
Member Avatar for Skado

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 …

Member Avatar for Teme64
0
106
Member Avatar for Mr Brownstone
Member Avatar for Teme64
0
124
Member Avatar for danny1405

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 …

Member Avatar for danny1405
0
99
Member Avatar for Anticipation

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 …

Member Avatar for Teme64
0
116
Member Avatar for Mr Brownstone

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]

Member Avatar for Mr Brownstone
0
94
Member Avatar for Anticipation

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.

Member Avatar for Teme64
0
101

The End.