See if this helps.
MsgBox(Date.Now.AddDays(90).ToShortDateString)
MsgBox(Date.Now.AddDays(-90).ToShortDateString)
See if this helps.
MsgBox(Date.Now.AddDays(90).ToShortDateString)
MsgBox(Date.Now.AddDays(-90).ToShortDateString)
Also, set the Label's AutoSize = False
in the Label's Properties.
This will let you resize the Label.
If you need code, see if this helps.
1 DateTimePicker, 1 Label
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With Label1
.BackColor = Color.White '// keep color of DateTimePicker.
.AutoSize = False '// allow's resizing of Label.
.Size = New Size(DateTimePicker1.Width - 80, 16) '// sized to fit the DateTimePicker's window.
.Text = "- Please Select Date - " '// your text.
.TextAlign = ContentAlignment.MiddleCenter '// align text.
.Location = New Point(DateTimePicker1.Location.X + 5, DateTimePicker1.Location.Y + 2) '// place Label in proper location.
.BringToFront() '// bring to front if needed.
End With
End Sub
End Class
Placing a Label over the DateTimePicker could do the trick.
See if this helps.
Dim lvItem As New ListViewItem(TextBox1.Text) '// declare new ListView item and set TextBox.Text as item.Text.
With lvItem.SubItems
.Add(ComboBox1.Text) '// SubItem 1 for Column 2.
.Add(ComboBox2.Text) '// SubItem 2 for Column 3.
End With
ListView1.Items.Add(lvItem) '// add item to ListView.
See if this helps.
With ListView1 '// shorten code.
If Not .Items.Count = 0 Then '// check if items in ListView.
Dim sNameSearch As String = InputBox("Type in the name of the member to search for.", "Search for gym member")
'// search ListView for item.
Dim foundItem As ListViewItem = .FindItemWithText(sNameSearch, True, 0, False)
'// pressing Cancel in InputBox will return "" as a value.
If Not sNameSearch = "" Then '// if not Cancel or not an empty value.
If foundItem IsNot Nothing Then '// if item has been found.
.MultiSelect = False '// disable MultiSelect to only select the found item.
.TopItem = foundItem '// bring item to top of ListView without having to scroll.
foundItem.Selected = True '// select item to highlight.
.MultiSelect = True '// enable MultiSelect again if needed.
.Select() '// .Select ListView to display the highlighted item.
End If
End If
Else
MsgBox("cannot search for something if it isn't there", MsgBoxStyle.Information) '// if no items in ListView.
End If
End With
Not sure if you are aware that using "1" as Start Index, will start the search at the second item added in the ListView.
That wind blew a ship at sea
off topic: Let's just hope that wind is the wind of wisdom and not the wind from "susheelsundar" pants. Cause if it is, then there is more than just a party going on in "susheelsundar"'s pants.
A sea of dreams, an ocean of...
I would probably use a Timer that runs that code on a different Thread every so often.
I can barely see, the fog is moving in, and it's green, and it's coming from that samurai's suit.
Not sure if my head is swelling or my body shrinking, but that is potent.
Since the queen died, the king killed himself because he was not feared.
Without anyone to lead them, everyone burnt down their houses and ran around in circles until they died also.:D
I guess it is only fair for a new beginning, somewhere else.
I'll start...
The wind of wisdom was upon a...
^ Did not type for me, but ate the cookies
< Is currently online
V Thinking if their shoes are comfortable
chopped the onions in round shapes only.
only a few ever told him. More...
I just farted in this suit and I gotta tell you, it stinks.
If this is for a ListView, see if this helps.
With ListView1
If Not .SelectedItems.Count = 0 Then '// check if item is selected.
.SelectedItems(0).SubItems(1).Text = "Logged Out" '// change .Text of .SubItem.
'// .SubItems(1) = column 2, .SubItems(2) = column 3, etc..
Else
MsgBox("Please select a ""specified personnel"" to log out.", MsgBoxStyle.Information)
End If
End With
See if this helps.
For Each itemcode As Match In matches
With itemcode
If .Value.Contains(")") Then '// make sure the .Value has data needed.
'// .Substring(4, .Value.Length - 6) = 4 for "<td>", -6 for "<td>" and the end of item for "<a".
CheckedListBox1.Items.Add(.Value.Substring(4, .Value.Length - 6))
End If
End With
Next
he wasn't feared, but loved. With every...
Private bAllowF2KeyPress As Boolean = True
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If bAllowF2KeyPress = True Then
If e.KeyCode = Keys.F2 Then If Button1.Enabled = True Then Button1.Enabled = False '// Disable.
End If
If e.KeyCode = Keys.F12 Then
If Button1.Enabled = False Then Button1.Enabled = True '// Enable.
bAllowF2KeyPress = False '// set to False to not allow the F2 key to disable Button.
End If
End Sub
A king with one rule, to...
Even though it's 2011, I still get paid in rice.:'(
>>Hey are you talking to me, disk. I thought a disk can't talk
Being a programmer, I should be able to make anything talk, even a disk.:-O
Being late night here, I actually wondered what a big red X looks like painted over a DataGridView. :D
I have used this in the past for Threading and it solved the issue.
Public Sub gogogo()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf gogogo))
Else
'// your code here.
End If
End Sub
More info located here.
Try replacing the first line w/the first 2 lines provided in my previous post. Partial Class frm_Merge
should be on the second line, not first.
Place this line of code in your Form's .Load event.
Control.CheckForIllegalCrossThreadCalls = False '// allow cross threading.
I am not really sure since I have never converted a project from vb6 to vb.net, although when loading a Form1.Designer.vb in Notepad++ or Notepad, your image code looks similar to it.
Try replacing the first lines of code with these lines.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frm_Merge
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
EDIT::
Overlooked the image again and it seems that maybe just adding a line break in between <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
and Partial Class frm_Merge
should solve the issue.
I'm actually more bushi than you think.
until another servant is called "roy" also.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '// keep focus of keys on Form.
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.F2 Then If Button1.Enabled = True Then Button1.Enabled = False '// Disable.
If e.KeyCode = Keys.F12 Then If Button1.Enabled = False Then Button1.Enabled = True '// Enable.
End Sub
End Class
I personally would use a ListView for a "time-in, time-out program".
See if this helps.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As New Memory
MsgBox(x.GetMemory)
End
End Sub
End Class
Public Class Memory
Public Function GetMemory() As String
Dim MemBitSize As String = CStr(My.Computer.Info.TotalPhysicalMemory)
Select Case CDec(MemBitSize)
Case 0 To CDec(999.999)
MemBitSize = Format(CInt(CDec(MemBitSize)), "###,###,###,###,##0 bytes")
Case 1000 To CDec(999999.999)
MemBitSize = Format(CInt(CDec(MemBitSize) / 1024), "###,###,###,##0 KB")
Case 1000000 To CDec(999999999.999)
MemBitSize = Format(CInt(CDec(MemBitSize) / 1024 / 1024), "###,###,##0 MB")
Case Is >= 1000000000
MemBitSize = Format(CInt(CDec(MemBitSize) / 1024 / 1024 / 1024), "#,###.00 GB")
End Select
Return MemBitSize
End Function
End Class
MsgBox(Format((My.Computer.Info.TotalPhysicalMemory / 1024) / 1024, "###,###,##0.00 MB"))
MsgBox(Format((My.Computer.Info.TotalPhysicalMemory / 1024) / 1024 / 1024, "###,###,##0 GB"))
, that shall be called "prince albert".
(p.s. I am never going to be knight:D)
A "smart" samurai knows about avatars and not how to use a private message.
.Does that still make him smart? Does a samurai even have to be smart?
I know a ninja would send a private message and notify someone about something like uploading images, cause they're "ninjas". :D
laws for days and knights were after.
And the first song, was the last
I am personally not clear of what GetServerDateTime
returns/is/or does, but see if this helps.
Dim dtServer As DateTime = CDate(Format(GetServerDateTime, "MM/dd/yyyy hh:mm:ss tt")).AddMinutes(+2) '// server date/time.
Dim dtUser As DateTime = CDate(Format(Now, "MM/dd/yyyy hh:mm:ss tt")) '// date/time on user p.c..
If dtServer >= dtUser Then '// check if the server date/time +2 minutes, equals or is greater than the users p.c. time.
MsgBox("allow")
Else
MsgBox("cancel")
End If
See if this helps.
MsgBox(Format(Now.AddMinutes(5), "MM/dd/yyyy hh:mm:ss tt"))
MsgBox(Format(Now.AddMinutes(-5), "MM/dd/yyyy hh:mm:ss tt"))
>>However I can not figure out how to Save using active child just calling the actual form name.
In any case, if just one control on the MdiForm, see if this helps.
If Not Me.ActiveMdiChild Is Nothing Then
MsgBox(Me.ActiveMdiChild.Controls(0).Text)
End If
If you were getting the Conversion from type 'Match' to type 'String' is not valid.
, you just needed to get the .Value of the Match
.
For Each itemcode As Match In matches
ListBox1.Items.Add(itemcode.Value)
Next
See if this helps.
With frmCitation.txtPlate
If Not .Text = "" Then '// check if TextBox has text.
writer.WriteStartElement("VEHICLE_LICENSE_NUMBER") '10-28
writer.WriteString(.Text.ToString)
writer.WriteEndElement()
End If
End With
For Each item As ListViewItem In ListView1.Items
If item.Checked = False Then '// check if Not Checked.
MsgBox(item.SubItems(1).Text) '// get value of "item" .SubItems(1).
End If
Next
See if this helps.
Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click
If Not Me.ActiveMdiChild Is Nothing Then '// check if Form available.
MsgBox(Me.ActiveMdiChild.Name) '// get .Name of Active Form.
End If
End Sub
See if this helps.
Private Sub DataGridView1_RowsAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles DataGridView1.RowsAdded
If DataGridView1.RowCount = 10 Then Button1.Enabled = False
End Sub
You are getting the error because mydr(9)
is not declared and you probably have it declared as mydr(8)
or less than 8.
To check if a ListView .SubItem exists, see if this helps.
Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
With ListView1
If Not .SelectedItems.Count = 0 Then '// check if item is selected.
With .SelectedItems(0).SubItems(1)
If .Text = "" Then
MsgBox("No value for first SubItem, or No value in Column 2 for the selected item.")
Else
MsgBox("value found: " & .Text)
End If
End With
End If
End With
End Sub
See if this helps to get you started.
1 TextBox, 1 Button, 3 RadioButtons
Public Class Form1
Private dValue, dInterest, dTotal As Double
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.Checked = True '// check first RadioButton.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then '// If NO value in TextBox.
MsgBox("Enter value in TextBox.", MsgBoxStyle.Critical)
Exit Sub '// skip remaining code and Exit the Sub.
End If
'// If a value in TextBox.
dValue = CDbl(TextBox1.Text) '// set value of TextBox as a Double.
'//-- get Interest.
If RadioButton1.Checked Then dInterest = dValue * 0.08 '// multiply value by 8%.
If RadioButton2.Checked Then dInterest = dValue * 0.1 '// multiply value by 10%.
If RadioButton3.Checked Then dInterest = dValue * 0.12 '// multiply value by 12%.
'--\\
dTotal = dValue + dInterest '// get Total.
'// display result with currency format.
MsgBox("Interest: " & dInterest.ToString("c") & vbNewLine & "Total: " & dTotal.ToString("c"))
End Sub
End Class
If you want a Numeric TextBox, then check out this Code Snippet thread.
That seems to be a paid project.
Seems more like a school project.
See if this helps.
For x = 0 To 7
If Not score(x) = Nothing Then totalScore += score(x) '// add to totalScore.
Next
See if this helps.
With DataGridView2.CurrentRow
CheckBox1.CheckState = CType(CInt(.Cells(0).Value), CheckState)
CheckBox2.CheckState = CType(CInt(.Cells(1).Value), CheckState)
End With
.Value of "0" is Checked = False and .Value of "1" is Checked = True.
See if this helps.
1 Timer, 1 TextBox
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
With TextBox1
'// check if Clipboad has Text and if Not TextBox has the Clipboard Text already.
If Clipboard.ContainsText AndAlso Not .Text = Clipboard.GetText Then
.Clear() : .Paste() '// clear for new data and paste to TextBox.
End If
End With
End Sub
End Class
>> I would like to categorize the items in the list. I would like to make it to where anyone can change the categories in the list without having to have access to the source code.
What about adding a ContextMenu to the item with a "Edit Item" option that loads a Form and allows you to edit the item.Text, .Tag, .etc.?
Can you post the entire For/Next loop code and specify which line is giving you the finger, I mean "error".:D
>>Is there a way to put comments in the .ini's that the reader will ignore?
I believe that comment lines for a .ini file start with ";".
[category title 1]
;Documentation=kewl
Application Name=VS Professional
Application Path to EXE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Description=Software developing product
[category title 2]
;Documentation=kewl also
Application Name=Firefox
Application Path to EXE=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
Description=Web browser of choice
I would load the file in a String Array and loop thru lines.
See if this helps for adding items with .Click Event and ToolTipText to a ToolStripDropDownButton.
1 ToolStripDropDownButton
Public Class Form1
Private myIniFile As String = "C:\test.ini" '// your File.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IO.File.Exists(myIniFile) Then
Dim arTemp() As String = IO.File.ReadAllLines(myIniFile) '// load lines as arrays.
For i As Integer = 0 To arTemp.Length - 1 '// loop thru lines.
'// check for lines like: [category title 1]
If arTemp(i).StartsWith("[") Then '// once located, you know the next 4 lines are for that category.
'// line 2 in category.
Dim mItem As New ToolStripMenuItem(arTemp(i + 2).Substring(arTemp(i + 2).IndexOf("=") + 1)) '// add .Text of item.
'// line 3 in category.
mItem.Tag = arTemp(i + 3).Substring(arTemp(i + 3).IndexOf("=") + 1) '// add FullPath to .Tag.
'// line 4 in category.
mItem.ToolTipText = arTemp(i + 4).Substring(arTemp(i + 4).IndexOf("=") + 1) '// add Description as ToolTipText.
AddHandler mItem.Click, AddressOf myCoolDropDownItems_Click '// give the DropDownItem an Event to handle.
ToolStripDropDownButton1.DropDownItems.Add(mItem) '// add item to …
See if this helps.
1 ComboBox (with items as stated in your post)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With ComboBox1
'//-- set for AutoComplete.
.AutoCompleteSource = AutoCompleteSource.CustomSource
.AutoCompleteMode = AutoCompleteMode.SuggestAppend '--\\
AddHandler .Validating, AddressOf cmb_Validating '// add ComboBox to Validating Event.
End With
'// use this to load/reload the AutoCompleteList with the ComboBox items.
loadMyCoolAutoCompleteList(ComboBox1)
End Sub
Private Sub loadMyCoolAutoCompleteList(ByVal selectedComboBox As ComboBox)
With selectedComboBox
.AutoCompleteCustomSource.Clear() '// Clear AutoCompleteList.
For Each itm As String In selectedComboBox.Items '// loop thru all items in the ComboBox.
.AutoCompleteCustomSource.Add(itm) '// add original item to your AutoCompleteList.
'// locate the .Substring you want to add to the AutoCompleteList.
itm = itm.Substring(itm.IndexOf(":") + 2) '// get all text following the ":" and the " " right after it.
.AutoCompleteCustomSource.Add(itm) '// add .Substring of item to your AutoCompleteList.
Next
End With
End Sub
'// once the ComboBox Validates (looses focus), it will set the original item as .Text.
Private Sub cmb_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
Dim selectedComboBox As ComboBox = CType(sender, ComboBox)
For Each itm As String In selectedComboBox.Items '// loop thru all items in the ComboBox.
If itm.Substring(itm.IndexOf(":") + 2) = selectedComboBox.Text Then '// locate the .Substring that matches the .Text.
selectedComboBox.Text = itm '// set .Text of ComboBox item.
Exit For '// exit loop since done locating item.
End If
Next
End Sub
End Class