can someone give me a code to load the textfile in a listview????
fretje, I'll send you a private message since some details are needed.
Unless.... the following link might just provide that information.
Save/Load Listview Items + Subitems
can someone give me a code to load the textfile in a listview????
fretje, I'll send you a private message since some details are needed.
Unless.... the following link might just provide that information.
Save/Load Listview Items + Subitems
See if this helps by using the Deactivate event.
Private Sub Form1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Deactivate
'// your code here to show the notify icon.
End Sub
To hide the icon, use the Activated event.
Dim myFile As String = "C:\test.txt" '// file location.
Dim myWriter As New IO.StreamWriter(myFile)
For Each myItem As ListViewItem In ListView1.Items
myWriter.WriteLine(myItem.Text & "|" & myItem.SubItems(1).Text & "|" & myItem.SubItems(2).Text)
Next
myWriter.Close()
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Select Case e.KeyChar
Case "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", vbBack '// numeric and backspace.
Exit Sub
Case Else
e.Handled = True
End Select
End Sub
Should work.
Using shortcut keys to Cut, Copy, Paste does not.
Question: How can I get my Windows Form for the players names to load when the application is started, do I use a form load event???
You can always add a new Form, go to Project/"your application" Properties..., Application Tab, and locate the "Startup form:" option.
Or just use the Form_Load event for the Startup Form.:)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.ShowDialog()
End Sub
End Class
If unsure of what .Net Framework you application was created for use in, locate vb.net File menu/ Project/"your application" Properties...
Click the compile tab and very last option "Advanced Compile Options...", which should show the .Net Framework your application needs in order to function.
If unsure of what .Net Framework the other p.c. that resulted your setup file in an error, paste the following JavaScript code in the address bar of Internet Explorer on their p.c.
javascript:alert(navigator.userAgent)
An alert should display some information.
Locate all the .Net sections, which should display all of the .Net Frameworks installed on that p.c.
Attached is a image of what displays on my p.c. with the Frameworks I currently have available to run application with.
If Closing is the same as Line Reading then see if this helps.
Dim myCoolFile As String = "C:\test.txt" '// your file.
Dim line1 As Integer = 0, line2 As Integer = 1, line3 As Integer = 2, line4 As Integer = 3
If IO.File.Exists(myCoolFile) Then
Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file as a string array.
Dim tempStr As String = ""
For i As Integer = 0 To myCoolFileLines.Length - 1 Step +4
tempStr = myCoolFileLines(line1)
line1 += 3
tempStr &= " - " & myCoolFileLines(line2)
line2 += 3
tempStr &= " - " & myCoolFileLines(line3)
line3 += 3
tempStr &= " - " & myCoolFileLines(line4)
line4 += 3
MsgBox(tempStr)
Next
End If
See if this helps.
Private Sub Panel1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel1.MouseHover
If Panel1.Height = 200 Then Exit Sub
For i As Integer = 100 To 200 Step 1
Panel1.Height = i
Next
End Sub
Private Sub Panel1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel1.MouseLeave
If Panel1.Height = 100 Then Exit Sub
For i As Integer = 200 To 100 Step -1
Panel1.Height = i
Next
End Sub
See if this helps.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("A cool little message.")
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
If e.KeyCode = Keys.Enter Then
Button1_Click(sender, e)
End If
End Sub
If you are using the same Button Event to close the Form as well, just add the "Form Close" code last.
Dim myDataString As String = "0-AGF-MYR-100101"
Dim myArray() As String = myDataString.Split("-") '// separate each item.
For i As Integer = 0 To myArray.Length - 1 '// loop thru myArray.
'// code to add datatable column here.
MsgBox(myArray(i)) '// display result.
'//
Next
:)
Just tunning up my sport car to test it in your county.:D
I ended up downloading the project file and am currently overlooking the Daily Log Form.
You may delete the project from your website if preferred.
I do appreciate the concern about downloading strange files/projects since I do feel the same way. However, I did scan with AVG, both the zip and unzipped folder, and looks promising. If I cannot trust anything, I probably would not trust myself, not AVG. :D
I will send a private message when done overlooking the code.
Nice website btw.:)
See if this helps.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'// create and customize.
Dim myCoolTextBox As New TextBox
myCoolTextBox.Text = "my new textbox."
myCoolTextBox.Multiline = True
myCoolTextBox.ScrollBars = ScrollBars.Vertical
myCoolTextBox.Size = New Size(200, 500)
'// add to form.
Me.Controls.Add(myCoolTextBox)
End Sub
This code sample will add appropriate Events for each textbox defined and also add the "Start" time for a new row and "End" time for the current row.
Public Class Form1
Dim activeCtl As TextBox '// control that is currently in focus.
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.F1 Then
Dim tempStr As String = TimeOfDay
tempStr = tempStr.Substring(0, tempStr.Length - 6) '// get only hours and minutes.
If activeCtl.Name.StartsWith("Start") Then
activeCtl.Text = tempStr '// add Start time.
Exit Sub '// skip remaining code.
End If
'// add "Start" time for next line of textboxes and add "End" time for the current line of textboxes.
If activeCtl.Name.StartsWith("Case") AndAlso activeCtl.Tag = "enter Key pressed." Then
Dim ctlNumber As String = activeCtl.Name.Substring(4, activeCtl.Name.Length - 4) '// get number of textbox.
For Each ctlStart As Control In TabControl1.TabPages(0).Controls '// loop thru controls.
If TypeOf (ctlStart) Is TextBox And ctlStart.Name = "Start" & ctlNumber + 1 Then '// if textbox and next in line.
ctlStart.Text = tempStr '// add "Start" time.
For Each ctlEnd As Control In TabControl1.TabPages(0).Controls '// loop thru controls to locate the preceeding End time.
If TypeOf (ctlEnd) Is TextBox And ctlEnd.Name = "End" & ctlNumber Then ctlEnd.Text = tempStr '// add "End" time.
Exit For '// end loop.
Next
Exit For '// end loop.
End If
Next
End If
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '// important …
See if this helps.
'// Prerequisites: 3 TextBoxes.
'// TextBox1 = current start time, TextBox2 = case number, TextBox3 = current time in the start box on the next row
Public Class Form1
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.F1 Then
Dim tempStr As String = TimeOfDay
tempStr = tempStr.Substring(0, tempStr.Length - 6) '// get only hours and minutes.
If TextBox1.Focused Then TextBox1.Text = tempStr
If TextBox2.Focused AndAlso TextBox2.Tag = "enter Key pressed." Then TextBox3.Text = tempStr
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '// important when using keys pressed and having other controls on the Form.
End Sub
Private Sub TextBox2_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyUp
If e.KeyCode = Keys.Enter Then
TextBox2.Tag = "enter Key pressed." '// set the tag to some value.
End If
End Sub
Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.LostFocus
TextBox2.Tag = "" '// reset tag if lost focus.
End Sub
End Class
Code order, although your idea is right, this is not what xVent needs. He wants to make Line1 in LABEL1 white, line 2 in LABEL1 red, Line3 in LABEL1 blue etc. Your code shows the colour per label on different labels and not the lines in one label.
I figured that much, but for a simple solution that relates to his other thread, it should help.
Something else that might help if you use 1 Panel and 3 Labels.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.Visible = True
myCoolInfo("Label1.Text here.", "Label2.Text here.", "Label3.Text here.")
End Sub
Sub myCoolInfo(ByRef myCoolInfo_1 As String, ByRef myCoolInfo_2 As String, ByRef myCoolInfo_3 As String)
Label1.Text = myCoolInfo_1
Label2.Text = myCoolInfo_2
Label3.Text = myCoolInfo_3
End Sub
End Class
Hello ,
I have a label on my code and i have 3 lines on it , what i want to do is to have my first line on white color and bold , next line normal white and third line on yellow normal ..
still searching for a solution.
Thanks.
If you are using similar code from your other thread, why not add a panel that contains 3 labels, each with your preset fonts/colors, and set the panel to visible/not visible as needed?
Setting "Panel1.AutoSize = True" should also help.:)
See if this helps.
'// Prerequisites: 1 Label, 3 PictureBoxes.
Public Class Form1
Private myClickCounter As Integer = 1
Private myCursorLocation As Point
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Visible = False
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click
Select Case sender.name
Case "PictureBox1"
Select Case myClickCounter
Case 1 : Label1.Text = sender.name & " clicked 1 time."
myClickCounter += 1
Case 2 : Label1.Text = sender.name & " clicked 2 times."
myClickCounter = 1
End Select
Case "PictureBox2"
Select Case myClickCounter
Case 1 : Label1.Text = sender.name & " clicked 1 time."
myClickCounter += 1
Case 2 : Label1.Text = sender.name & " clicked 2 times."
myClickCounter = 1
End Select
Case "PictureBox3"
Select Case myClickCounter
Case 1 : Label1.Text = sender.name & " clicked 1 time."
myClickCounter += 1
Case 2 : Label1.Text = sender.name & " clicked 2 times."
myClickCounter = 1
End Select
End Select
End Sub
Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles PictureBox1.MouseEnter, PictureBox2.MouseEnter, PictureBox3.MouseEnter
Label1.Visible = True
PictureBox1_Click(sender, e) '// if you want to reset the clicks.
Label1.Location = New Point(myCursorLocation.X + 5, myCursorLocation.Y + 5) '// offset label.
End Sub
Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles PictureBox1.MouseLeave, PictureBox2.MouseLeave, PictureBox3.MouseLeave
Label1.Visible = False
myClickCounter = 1
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
myCursorLocation = e.Location
End Sub …
Just wanted to add the code for a custom message box in case the link I previously posted might expire.
'// ------------- Prerequisites: 1 Button required on Form1 ------------- \\
Public Class Form1
'// ------------- DYNAMICS ------------- \\
'// message box Form.
Public WithEvents myMessageForm As New Form With _
{.Size = New Size(300, 200), .MinimizeBox = False, .MaximizeBox = False, _
.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D, .ControlBox = False}
'// picturebox to display the Icon.
Public infoImage As New PictureBox With _
{.Location = New Point(20, 30), .Size = New Size(40, 40), .SizeMode = PictureBoxSizeMode.StretchImage}
'// label to display Information.
Public infoLabel As New Label With _
{.Font = New Font("Verdana", 10), .AutoSize = True, .Location = New Point(65, 40)}
'// background label for the Buttons.
Public btnBgLabel As New Label With _
{.BackColor = Color.Gainsboro, .Location = New Point(0, 120), _
.Size = New Size(myMessageForm.width, 80)}
'// buttons
Public WithEvents btn1 As New Button With {.Location = New Point(18, 127), .Size = New Size(120, 35), _
.Text = "Sure Is...", .Font = New Font("Verdana", 10)}
Public btn2 As New Button With {.Location = New Point(150, 127), .Size = New Size(120, 35), _
.Text = "Whatever", .Font = New Font("Verdana", 10)}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Size = New Size(500, 350) '// resize form.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
showMyMessagebox() '// Load the Custom Message Box.
End Sub
Sub showMyMessagebox()
Dim infoIcon As Icon …
See if this helps.
Prerequisites: 1 ListView, 1 Button.
Public Class Form1
Private myCoolFile As String = "C:\test.txt" '// your file.
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim myWriter As New IO.StreamWriter(myCoolFile)
For Each myItem As ListViewItem In ListView1.Items
myWriter.WriteLine(myItem.Text & "#" & myItem.SubItems(1).Text) '// write Item and SubItem.
Next
myWriter.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView1.View = View.Details : ListView1.Columns.Add("column 1") : ListView1.Columns.Add("column 2")
If IO.File.Exists(myCoolFile) Then '// check if file exists.
Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file as a string array.
For Each line As String In myCoolFileLines '// loop thru array list.
Dim lineArray() As String = line.Split("#") '// separate by "#" character.
Dim newItem As New ListViewItem(lineArray(0)) '// add text Item.
newItem.SubItems.Add(lineArray(1)) '// add SubItem.
ListView1.Items.Add(newItem) '// add Item to ListView.
Next
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static i As Integer = 0
Dim newItem As New ListViewItem("item " & i) '// add text Item.
newItem.SubItems.Add("subitem " & i) '// add SubItem.
ListView1.Items.Add(newItem) '// add Item to ListView.
i += 1
End Sub
End Class
... The count also needs to stay in the 0000 format. ie; 0001, 0002, all the way up to 9999....
I must have missed this part.:'(
Replace the last code line in Timer1_Tick() from:
Me.Text = intCounter & " - Interval Speed: " & Timer1.Interval
To:
Me.Text = intCounter.ToString("#000#") & " // Interval Speed: " & Timer1.Interval
:)
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case TabControl1.SelectedIndex
Case 0
MsgBox("Tab 1 Activated.")
Case 1
MsgBox("Tab 2 Activated.")
End Select
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = TextBox1.Text.Replace("case", "cAsE")
End Sub
Using .txt File.
Public Class Form1
Private myCoolFile As String = "C:\test.txt" '// your file.
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
IO.File.WriteAllText(myCoolFile, TextBox1.Text) '// overwrite/create file.
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IO.File.Exists(myCoolFile) Then '// check if file exists.
TextBox1.Text = IO.File.ReadAllText(myCoolFile) '// load file content.
End If
End Sub
End Class
Using My.Settings.
From the vb.net top Menu, click Project and select yourApplication Properties...
Locate the Settings Tab and add "valid" as your setting Name.
Serial number thread.
I created a String setting named "myCoolText".
Just make sure your Application has been previously saved.
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.myCoolText = TextBox1.Text
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = My.Settings.myCoolText
End Sub
End Class
Or ApplicationSettings.
http://www.daniweb.com/forums/post1330523.html#post1330523
Prerequisites: 1 Timer, 2 Buttons, 1 NumericUpDown.
Public Class Form1
Private myCount As String = "positive count"
Private intCounter As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Start" : Button2.Text = "Positive"
Me.Text = "0"
NumericUpDown1.Minimum = 1
NumericUpDown1.Maximum = 13
Timer1.Interval = 50
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Start" Then
Button1.Text = "Stop" : Timer1.Start()
Else
Button1.Text = "Start" : Timer1.Stop()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button2.Text = "Positive" Then
Button2.Text = "Negative" : myCount = "negative count"
Else
Button2.Text = "Positive" : myCount = "positive count"
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If myCount = "positive count" Then intCounter += 1
If myCount = "negative count" Then intCounter -= 1
Me.Text = intCounter & " - Interval Speed: " & Timer1.Interval
End Sub
Private Sub NumericUpDown1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
Timer1.Interval = NumericUpDown1.Value * 100 / 2 '// just a random equation for project testing.
'// or you can use a select case.
'Select Case NumericUpDown1.Value
' Case 1
' Timer1.Interval = 50
' Case 2
' Timer1.Interval = 100
' Case 3
' Timer1.Interval = 150
' '// etc.
'End Select
End Sub
End Class
Creating your own custom Message Box is probably the only way to add an image to it.
Check out this link and locate Custom Message Boxes.
http://visualbasicnet.weebly.com/message-boxes.html
I have just retested the sample project and it looks like It causes a slight error when targeting a .Net Framework less than 3.5.
This line of code,
For i As Integer = 0 To myCoolFileLines.Count - 1 '// for each array.
should actually be.
For i As Integer = 0 To myCoolFileLines.Length - 1 '// for each array.
If the file is exactly as you posted and each line does not have any extra spaces added to the end of the line, the project should respond as asked.
Copy and Paste the entire source code in a new Project.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'// customize Form.
Me.Size = New Size(415, 300) : Me.Icon = SystemIcons.Information : Me.MaximizeBox = False
'// create and customize a ListView.
Dim myListView As New ListView With {.Location = New Point(0, 0), .Dock = DockStyle.Fill, .View = View.Details, _
.FullRowSelect = True, .Font = New Font("Verdana", 10)}
With myListView.Columns '// (column name, column width, column alignment)
.Add("Rank", 45, HorizontalAlignment.Center) : .Add("Team", 150) : .Add("Won", 45, HorizontalAlignment.Center)
.Add("Lost", 45, HorizontalAlignment.Center) : .Add("Percentage", 90, HorizontalAlignment.Center)
End With
'// add ListView to Form.
Me.Controls.Add(myListView)
Dim sortArray As New ArrayList '// array list to store modified strings (file lines).
Dim tempString As String = String.Empty '// string for modifying array strings.
Dim myCoolFile As String = "C:\test.txt" '// your file.
If IO.File.Exists(myCoolFile) Then '// check if file exists.
Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file lines as string arrays.
For i As Integer = 0 To myCoolFileLines.Count - 1 '// for each array.
Dim myArray() As String = myCoolFileLines(i).Split(" ") '// separate each line into arrays by space.
If myArray.Length = 4 Then '// if array contains a City with 2 words.
tempString = myArray(2) & "#" '// add games won.
tempString …
Sounds like you got a good topic :"Online Gaming". There are many aspects of this subject...
http://www.xtremevbtalk.com/showthread.php?t=175057
Do you have a personal interest that can be used as a topic?
hi,
i have send my codes thru private message. Have you got it.
:)
It has to do something with the way your code is setup.
You can post your code here for the 2 Forms OR if you want to keep it confidential you can send the code to me in a private message.
hi,
i have tried your code but its still accept more than 10 records...
I seriously doubt that.
About your code, try it in a new project.
Public Class Form1
'// Pre-requisites: 1 ListView, 1 Button.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView1.View = View.List
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nTotlistrec As Integer = ListView1.Items.Count
If nTotlistrec < 10 Then '// check if less than 10.
ListView1.Items.Add("new item" & ListView1.Items.Count + 1)
Else
MsgBox("you can only pay 10 bills per transaction")
End If
End Sub
End Class
You had <= instead of just <, which would add an extra item.
Just to create or overwrite a .txt file, try the following code.
Button1.Visible = False
Button2.Visible = False
Label5.Visible = False
'/////////////////////////////
Dim myCoolFile As String = "C:\myCoolTestFile.txt" '// your file location.
IO.File.WriteAllText(myCoolFile, TextBox1.Text & " / " & MaskedTextBox1.Text) '// save to file.
'/////////////////////////////
'// display confirmation AFTER saving the file.
Label3.Text = "Your information has been saved."
Label4.Text = ""
Something like this?
Pre-requisites: 2 Forms, each containing a Label.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.Label1.Text = "text from Form1"
Form2.Show()
End Sub
End Class
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.Label1.Text = Form1.Text
End Sub
End Class
If Not ListView1.Items.Count = 10 Then
ListView1.Items.Add("new item")
End If
See if this helps.
For i As Integer = 1 To 35
ListBox1.Items.Add("item " & i) '// add 35 items to the ListBox.
Next
For i As Integer = ListBox1.Items.Count + 1 To 50
ListBox1.Items.Add("item " & i) '// add the remaining items to the ListBox.
Next
MsgBox("Total Items: " & ListBox1.Items.Count)
here is my code....
code for button..
Dim born, today As Integer
Dim now() As String
Dim now1 As String
now1 = Date.Today
now = now1.Split("/")
born = CInt(TextBox1.Text)
today = CInt(now(2))
born = today - born
TextBox2.Text = bornwhat i want is that i want to use the datetimepicker and it automatically compute the age in another textbox without clicking the button..
I have modified your code slightly, but for future references arjen, please refrain from using Variables that relate to vb.net.
Example, you declared now and today, which are both used by vb.net to access certain values.
TextBox1.Text = DateTimePicker1.Value.Year
Dim now1 As String = Date.Today
Dim now() As String = now1.Split("/")
Dim today As Integer = CInt(now(2))
Dim born As Integer = Today - CInt(TextBox1.Text)
TextBox2.Text = born
Dim myCoolBirthday As Date = DateTimePicker1.Value.Date '// selected value from DateTimePicker.
Dim currentDate As Date = Today '// value of current date.
Dim myAge As Integer = currentDate.Year - myCoolBirthday.Year '// subtract years from current date.
MsgBox("My age: " & myAge & vbNewLine & "Just don't tell anyone. :)") '// display age.
Add a ToolStrip from the Toolbox, right click it, and select "Insert Standard Items". (see attached image)
The standard icons are very limited, so online icon websites can become second nature towards locating the proper icons for your application.
Here is a link for a few Toolbar Icons.
The entire website for www.iconarchive.com is quite impressive, although most, if not all icons require to comply with the terms of the license.
Example:
License: Linkware
Commercial usage: Allowed
A simple web search for application icons is also quite useful as long as you comply with the terms for each website.
This is mostly when designing commercial not personal applications.
A personal note.
When adding icons/images to buttons that are small in size, re-size the icons/images to fit the buttons properly. This will cause the icons/images not to be distorted.
Waiting for the private message. :)
You will need to provide all details possible.
For example:
And have certain values for each.
Then specify how to add all those values up in order to send the complete details to the tailor.
Hi,
Dim Var as Double
Var = TabControl1.Textbox1.text
Please help !!
Dim Var As Double
Var = TextBox1.Text
TextBox1 should do just fine. :)
You can also use the (ApplicationSettings) located in a control's Properties.
For example, Label1:
Double-click or click the little arrow for (ApplicationSettings), which should be located at the very top of the Label1 Properties.
Locate Text, click the litte arrow and select (New...).
Give it a unique Name,press OK, and Done.:)
Run your application, change text for Label1 and restart your application. The text should have been restored as previously left.
You can also select different options to save from selecting the (PropertyBinding).
See if this helps.
Dim myCoolFileLines() As String = IO.File.ReadAllLines("C:\config.ini") '// load your file as a string array.
Dim array() As String = {""}
'// go thru each line.
For Each rLine As String In myCoolFileLines
array = rLine.Split("=")
For i As Integer = 0 To array.Length - 1
MsgBox(array(i))
Next
Next
'// get a single line.
array = myCoolFileLines(1).Split("=") '// line 2.
MsgBox(array(0))
MsgBox(array(1))
Imports System.IO
Public Class Form1
Private file_name As String = "jpeg.rtf"
Private tempString As String = Date.Now
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'/////////////////////////////
tempString = tempString.Replace("/", "-")
'// unless you replace these character, the file name returns invalid and causes errors.
tempString = tempString.Replace(":", ".")
'////////////////////////////
Dim path1 As String = Trim("D:\frs\files\" & file_name)
Dim path2 As String = Trim("D:\frs\versions\" & tempString & " " & file_name) '// modified.
File.Copy(path1, path2)
MsgBox("File copied to:" & vbNewLine & path2)
End
End Sub
End Class
As mentioned, you are trying to create a file with invalid characters for the file name.
Also, you are trying to copy the file to a folder that does not exist so I modified the code in path2.
One more thing, your declared variable "Now" might conflict with the vb.net code for Now.
Try using something that does not cause/or could cause conflicts.
Hope this helps.
Posting code always helps, even if having to make a sample project just for such.
See if this helps.
Public Class Form1
'// your application's folder that contains all Forms.
Private myAppFolder As String = "C:\Users\codeorder\Desktop\vb.net\WindowsApplication1\WindowsApplication1"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myCoolFileLineCount As Integer = 0
For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
(myAppFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*") '// scan folder.
If IO.Path.GetExtension(myCoolFile) = ".vb" Then '// get all files with the .vb file extension.
If Not IO.Path.GetFileName(myCoolFile).Contains(".Designer.vb") Then '// remove files that are Designer files.
Dim myCoolForm As String = IO.Path.GetFullPath(myCoolFile) '// get full path of file.
Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolForm) '// load your file as a string array.
myCoolFileLineCount += myCoolFileLines.Length '// count lines and add to the sum total.
End If
End If
Next
'// display your application's total code line count.
MsgBox(Application.ProductName & vbNewLine & "Total Code Lines Count: " & myCoolFileLineCount, MsgBoxStyle.Information)
End Sub
End Class
Please supply the proper information when FIRST asking a question.
Thank you.
figured it out, it was the first form with an index of 0 instead of 1. durh.
Glad the link I previously posted helped. :)