16.12.10

Sender Application VB.NET

Hi Everybody,
I would like to explain one of faq within this essay , how can I can use sender with VB.NET windows application? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new Windows Application Project (sender_windows_application)



2-) We are designing this windows form in a similar way to bellowing picture





3-)We are writing this code


Private Sub show_alert_btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles show_alert_btn1.Click
Try
MsgBox(alert_txt.Text, vbInformation, "Sender Application")
Catch ex As Exception
MsgBox(ex.Message, "Sender Application")
End Try
End Sub

Private Sub show_alert_btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles show_alert_btn2.Click
show_alert_btn1_Click(sender, e)
End Sub

Private Sub show_alert_btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles show_alert_btn3.Click
show_alert_btn1_Click(sender, e)
End Sub

4-) Lets start application and click buttons

15.12.10

Print Document with VB.NET

Hi Everybody,
I would like to explain one of faq within this essay , how can I can use printpreview and printerdialog with VB.NET 2010 windows application? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new Windows Application Project (print_document)



2-) We are designing this windows form in a similar way to bellowing picture



3-)We are writing this code

Private Sub Print_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_btn.Click
printDocument1.Print()
End Sub

Private Sub Print_preview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_preview.Click
printPreviewDialog1.Document = printDocument1
printPreviewDialog1.ShowDialog()
End Sub

Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocument1.PrintPage
Dim fnt_t As Font
fnt_t = TextBox1.Font
e.Graphics.DrawString(TextBox1.Text, fnt_t, New SolidBrush(Color.Black), 10, 10)


End Sub


Private Sub fnt_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles fnt_btn.Click
Dim font_dialog As New FontDialog
If font_dialog.ShowDialog() = DialogResult.OK Then
TextBox1.Font = font_dialog.Font
End If
End Sub

4-) Lets start application and change font




5-) Click Printpreview button




Have a great day

Yener Turkeli
yenerturkeli@v-basic.net