Hi,
You can try something like this:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedItem
End Sub
Hi,
You can try something like this:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedItem
End Sub
Hi,
Try this:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("")
ComboBox1.Items.Add("1")
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If Not TextBox1.Text <> "" Then
ComboBox1.Enabled = True
Else
ComboBox1.Enabled = False
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If Not ComboBox1.SelectedIndex <> 1 Then
TextBox1.Enabled = False
Else
TextBox1.Enabled = True
End If
End Sub
Hi,
Add this:
'add control to form
Controls.Add(NT)
Hi nashy,
Glad to help.
You could mark your thread as "Solved" with the link below the last post.
Hi,
Here are other ways of doing it with Keychar or CharacterCasing:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
TextBox2.CharacterCasing = CharacterCasing.Upper 'already by formload can you set te Char in a Textbox toUpper
End Sub
Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Char.IsLower(e.KeyChar) Then
e.Handled = True
SendKeys.Send(Char.ToUpper(e.KeyChar))
End If
End Sub
Hope it helps,
Hi,
There isn't a property for that, but you can use this in the Form load event:
TabControl1.Dock = DockStyle.Fill
Hi,
Try this:
txbStateTaxPcnt.Text = stateSlsTax.ToString("#,0.00")
Hi Eternal Newbie,
He has already set the Form windowstate Maximum.
Hi,
No, only the one who has the focus and you want to write numbers in that textbox.
You can show numbers in the textboxes but not write numbers in them.
Try this example;
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox2.Text = "555-666-777"
End Sub
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown, TextBox2.KeyDown, TextBox3.KeyDown, TextBox4.KeyDown, TextBox5.KeyDown
Select Case e.KeyValue
Case Keys.A To Keys.Z
Case Keys.Space
Case Keys.Left, Keys.Right, Keys.Back
Case Else : e.SuppressKeyPress = True
End Select
End Sub
After debugging this example you'll see the text: 555-666-777 in textbox2.
Delete the text in TextBox2 and try to rewrite the numbers into the textbox2.
Hope it helps,
Hi GeekPlease,
You have the event for TextBox1_Keydown and this event wil happen only for KeyBox1.
Now, When you add more TextBoxes at the end of this event, like I showed you in previous post, then the event will also happen for the other TextBoxes when they have the focus.
Hope it helps,
Hi,
You can add as many Events as you want on the End. As long as the Subroutine can Handle them, the Event will happen.
Private Sub TextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs)Handles TextBox1.Keydown,TextBox2.Keydown,TextBox3.Keydown,TextBox4.Keydown ' as many as you have...
Hi Jockster,
Glad to help.
Mark your thread as resolved, so it can help others.
Grtz,
Hi,
In the Form2 Class add the form2_location event and then you can try this:
Private Sub Form2_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
Me.Location = New Point(Form1.Location.X + 30, Form1.Location.Y + 30)
End Sub
Hi,
I don't understand your question.
Do you want some code that after 10 days your application will expire?
Hi iFrolox,
The code created by Reverend Jim works perfect.
Did you do exactly what Jim suggested to do or has your forms backcolor the same color as the gotfocus color.
Do you have any errors?
Hi,
Your Class should look like this:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim name1, name2 As String
name1 = "Walter Bishop"
name2 = "Olivia Dunham"
MsgBox("The main characters of FRINGE are " & " " & name1 & " " & "and" & " " & name2)
End Sub
End Class
BTW your code is working perfect.
I only changed the message a little to make it more readable.
Hi,
I'm not sure what you mean with: how to add the grayed out screen.
So I think it is the Parent form property -> IsMdiContainer and set it to True.
Hi,
I think this is a better way to create a textfile:
Dim fs As New FileStream("Towns.txt", FileMode.Create, FileAccess.Write)
'declaring a FileStream and creating a text file named Towns with
'access mode of writing
Dim s As New StreamWriter(fs)
'creating a new StreamWriter and passing the filestream object fs as argument
s.Close()
'closing the file
Hi,
You can try this:
RichTextBox1.AppendText(Environment.NewLine)
Hi,
A ListBox with its Sorted set to true should not be bound to data using the DataSource property. To display sorted data in a bound ListBox, you should bind to a data source that supports sorting and have the data source provide the sorting.
Use the PrintDcoument class or
Hi chibex64,
That's the same what I suggested, but still waiting his response :icon_confused:
Hi,
All printings in .Net are done using the PrintDocument class. Basically, you will handle the PrintDocument.PrintPage event and write your code there using GDI+ to draw the page. When you want to print, you just call the Print method of your PrintDocument object. Whether you're printing a picture, a text page or a listview is not important. The principles are the same. You will get the paper size, the margins and calculate your print area. You also calculate the x, y cordinates of each item being printed. It's not simple in my opinion, but it's not too difficult either.
You can find an example, here.
Hi,
You can try this:
Private Shared ds As DataSet
Hi,
No problem, glad to help :)
Mark your thread as solved :)
i have a radio button and a text box. when i select the radio button, then will come out the text box to let user fill in. may i know to show the text box?
below are my coding.Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox2.Visible = True If RadioButton4.Checked = True Then TextBox2.Visible = True Else TextBox2.Visible = False End If End Sub End Class
hope someone can help me. thx
Hi,
You can do it like this example.
Add a textbox and 2 radiobuttons then try it:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Visible = False
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
TextBox1.Visible = True
Else
TextBox1.Visible = False
End If
End Sub
End Class
Hi,
To read a TextFile into a ListBox you can do it like this:
// Load the ListBox from a file.
private void Form1_Load(System.Object sender, System.EventArgs e)
{
try {
string file_name = DataFile();
System.IO.StreamReader stream_reader = new System.IO.StreamReader(file_name);
ListBox1.Items.AddRange(Strings.Split(stream_reader.ReadToEnd(), Constants.vbCrLf));
ListBox1.SelectedIndex = 0;
stream_reader.Close();
} catch (Exception exc) {
// Report all errors.
Interaction.MsgBox(exc.Message, MsgBoxStyle.Exclamation, "Read " + "Error");
}
}
I doesn't use C# offen, but it should work thought.
Hi,
To create a numeric textbox, look here.
To select a certain length, go to the properties of that textbox and set the Maxlength.
Hi,
No problem :)
Mark your thread as resolved, rating is a way of saying thank you! :)
Hi,
You can try something like this:
ListBox1.Items.Add("Balnce: " & amount). ToString("0.00")
Hi,
That error could be caused in the configuration of IIS.
What you can try is;
Change Classic mode by integrated mode in IIS options, and it should work then.
Was wondering, is it possible to create a class which has the majority of your keypress controls?
Like allowing just letters or numbers in a textbox etc....To make things clearer what i exactly want.
I have a textbox on my form.
This is a textbox for the postcode.
The postcode is supposed be something along the lines of AA 1234.
This will be checked on lostfocus.But i need to code this in a class, and this is where i am stuck.
Hi,
When you says that you need to do it in a Class means for me that you need to create a Custom TextBox right.
You can find an example (Checkbox) how to create a custom Control, here.
If however it isn't really necessary you can try a MaskedTextBox.
Try this:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MaskedTextBox1.Mask = "LL 0000"
End Sub
Private Sub MaskedTextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MaskedTextBox1.LostFocus
If MaskedTextBox1.MaskFull Then
MaskedTextBox1.BackColor = Color.Tomato
If MaskedTextBox1.MaskCompleted Then
MessageBox.Show("Entry in mask is valid", "Valid Entry", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Else
MaskedTextBox1.BackColor = Color.White
End If
End Sub
End Class
Hi,
Why do you use thoose boxes for?
Hi,
No problem :)
Mark this thread as resolved and rating is a way of saying thank you. Don't forget to rate always, thanks. :)
Hi,
For your first question.
It's working normal because you put it in the Timer Event.
That means every second the timer execute you'll have an item added into the Listbox.
What you can do is change the timer interval to the executiontime you need or put it into a Button event instead of timer.
For your second question, try this:
TextBox1.Text = Date.Now.DayOfWeek.ToString
Hi,
No problem :)
Mark this thread as resolved and rating is a way of saying thank you. Don't forget to rate always, thanks. :)
Hi,
You can try this;
Dim oReg As RegistryKey = Registry.CurrentUser
Dim oKey as RegistryKey = oReg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
oKey.SetValue("MyVBApp", cPGM)
Hi,
I think yoou can only send the generated file as attachment, but you can always write code that you can't change the specific Email ID.
See previous post how to send an Email.
thnk u vry much sir,
u done it.....now plz help me in my thread
http://www.daniweb.com/software-development/vbnet/threads/364490
Hi,
No problem :)
Mark this thread as resolved and rating is a way of saying thank you. Don't forget to rate always, thanks. :)
Hi,
You can try it like this:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim SelectedItems As ListView.SelectedListViewItemCollection = _
CType(sender, ListView).SelectedItems
If (SelectedItems.Count > 0) Then
Label1.Text = ListView1.SelectedItems(0).SubItems(0).Text
End If
End Sub
Hi,
I sould not use a Monthcalendar for this, but 2 Datetimepickers.
I made you a small example how I should do the calculation.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
System.DateTime d1 = DateTimePicker1.Value;
System.DateTime d2 = DateTimePicker2.Value;
TimeSpan ts = default(TimeSpan);
ts = d2.Subtract(d1);
if (!(ts.Days > 0)) {
Label1.Text = ("There are " + ts.Days + 1 + " " + "days");
} else {
Label2.Text = ("There are " + ts.Days + " " + "days");
}
int pricePerDay = 39.0;
Label2.Text = "Total is: " + (ts.Days * pricePerDay).ToString("C");
}
Because I'm not using C# offen is it possible that the're some errors in it.
Let me know if there some problems with it.