https://www.codecodex.com
Topic: Information
———
public class bubbleSort{
public static void main(String a[]){
int i;
int array[] = {12,9,4,99,120,1,3,10};
System.out.println("Values Before the sort:\n");
for(i = 0; i < array.length; i++)
System.out.print( array[i]+" ");
System.out.println();
bubble_srt(array, array.length);
System.out.print("Values after the sort:\n");
for(i = 0; i <array.length; i++)
System.out.print(array[i]+" ");
System.out.println();
System.out.println("PAUSE");
}
public static void bubble_srt( int a[], int n ){
int i, j,t=0;
for(i = 0; i < n; i++){
for(j = 1; j < (n-i); j++){
if(a[j-1] > a[j]){
t = a[j-1];
a[j-1]=a[j];
a[j]=t;
}
}
}
}
}
———
https://www.vkinfotek.com/
https://www.programmingtutorials.com/vbnet.aspx
https://www.devarticles.com/c/a/VB.Net/Deploying-Applications-in-VB.NET-Part-1/
https://www.supershareware.com/submit.html
https://www.codeguru.com/
———
Public Class form1
Private wbBrowserTab(0) As WebBrowser
Private currentTab As Integer
Private Const BLOCK_DEFAULT As String = "[DEFAULT]"
Private Const BLOCK_INTERNETSHORTCUT As String = "[InternetShortcut]"
Private Const ITEM_URL As String = "URL="
Private Const ITEM_BASEURL As String = "BASEURL="
Private Sub Navigate(ByRef URL As String)
If String.IsNullOrEmpty(URL) Then Return
If URL.Equals("about:blank") Then Return
If Not URL.StartsWith("https://") And _
Not URL.StartsWith("https://") Then
URL = "https://" & URL
End If
Try
wbBrowserTab(currentTab).Navigate(URL)
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wbBrowserTab(0) = New WebBrowser
TabControl1.TabPages(0).Controls.Add(wbBrowserTab(0))
wbBrowserTab(0).Dock = DockStyle.Fill
Me.Text = "Web Browser"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TabControl1.TabPages.Add("New tab page")
TabControl1.SelectedIndex() = TabControl1.TabCount - 1
currentTab = TabControl1.SelectedIndex
While currentTab >= wbBrowserTab.Length
ReDim Preserve wbBrowserTab(wbBrowserTab.Length)
End While
wbBrowserTab(currentTab) = New WebBrowser
wbBrowserTab(currentTab).Dock = DockStyle.Fill
TabControl1.TabPages(currentTab).Controls.Add(WebBrowser1)
End Sub
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
WebBrowser1.Navigate(txtURL.Text)
End Sub
Private Sub btnforward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnforward.Click
On Error Resume Next
WebBrowser1.GoForward()
End Sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
On Error Resume Next
WebBrowser1.GoBack()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
WebBrowser1.Refresh()
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
WebBrowser1.Stop()
End Sub
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim Open As New OpenFileDialog()
Dim URLFile As String()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Internet Favourite (*.url)|*.url|All files (*.*)|*.*"
Open.CheckFileExists = True
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
URLFile = myStreamReader.ReadToEnd().Split(New String() {ControlChars.CrLf}, _
StringSplitOptions.RemoveEmptyEntries)
For Each Item As String In URLFile
If Item.StartsWith(ITEM_URL) Then
Navigate(Item.Substring(ITEM_URL.Length))
Exit For
End If
Next
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Internet Favourite (*.url)|*.url|All files (*.*)|*.*"
Save.CheckPathExists = True
Save.FileName = wbBrowserTab(currentTab).DocumentTitle
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.CreateText(Save.FileName)
myStreamWriter.Write(BLOCK_DEFAULT & vbCrLf & _
ITEM_BASEURL & wbBrowserTab(currentTab).Url.ToString & vbCrLf & _
BLOCK_INTERNETSHORTCUT & vbCrLf & _
ITEM_URL & wbBrowserTab(currentTab).Url.ToString)
myStreamWriter.Flush()
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Dim Response As MsgBoxResult
Response = MsgBox("Are you sure you want to Exit Web Browser?", _
MsgBoxStyle.Question + MsgBoxStyle.YesNo, _
"Web Browser")
If Response = MsgBoxResult.Yes Then
End
End If
End Sub
Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
txtURL.Cut()
End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
txtURL.copy()
End Sub
Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
txtURL.paste()
End Sub
Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
txtURL.selectall()
End Sub
Private Sub GoToToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToToolStripMenuItem.Click
Navigate(txtURL.Text)
End Sub
Private Sub HomeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HomeToolStripMenuItem.Click
WebBrowser1.GoHome()
End Sub
Private Sub txtURL_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtURL.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(txtURL.Text)
End If
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
Me.Text = "Web Browser - " & WebBrowser1.DocumentTitle
txtURL.Text = WebBrowser1.Url.ToString
status.Text = e.Url.ToString()
Me.Text = WebBrowser1.DocumentTitle & " - Web Browser"
ProgressBar1.Visible = True
End Sub
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
ProgressBar1.Value = CInt(e.CurrentProgress)
End Sub
End Class
———
Public Class form1
Private wbBrowserTab(0) As WebBrowser
Private currentTab As Integer
Private Const BLOCK_DEFAULT As String = "[DEFAULT]"
Private Const BLOCK_INTERNETSHORTCUT As String = "[InternetShortcut]"
Private Const ITEM_URL As String = "URL="
Private Const ITEM_BASEURL As String = "BASEURL="
Private Sub Navigate(ByRef URL As String)
If String.IsNullOrEmpty(URL) Then Return
If URL.Equals("about:blank") Then Return
If Not URL.StartsWith("https://") And _
Not URL.StartsWith("https://") Then
URL = "https://" & URL
End If
Try
wbBrowserTab(currentTab).Navigate(URL)
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wbBrowserTab(0) = New WebBrowser
TabControl1.TabPages(0).Controls.Add(wbBrowserTab(0))
wbBrowserTab(0).Dock = DockStyle.Fill
Me.Text = "Web Browser"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TabControl1.TabPages.Add("New tab page")
TabControl1.SelectedIndex() = TabControl1.TabCount - 1
currentTab = TabControl1.SelectedIndex
While currentTab >= wbBrowserTab.Length
ReDim Preserve wbBrowserTab(wbBrowserTab.Length)
End While
wbBrowserTab(currentTab) = New WebBrowser
wbBrowserTab(currentTab).Dock = DockStyle.Fill
TabControl1.TabPages(currentTab).Controls.Add(WebBrowser1)
End Sub
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
WebBrowser1.Navigate(txtURL.Text)
End Sub
Private Sub btnforward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnforward.Click
On Error Resume Next
WebBrowser1.GoForward()
End Sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
On Error Resume Next
WebBrowser1.GoBack()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
WebBrowser1.Refresh()
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
WebBrowser1.Stop()
End Sub
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim Open As New OpenFileDialog()
Dim URLFile As String()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Internet Favourite (*.url)|*.url|All files (*.*)|*.*"
Open.CheckFileExists = True
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
URLFile = myStreamReader.ReadToEnd().Split(New String() {ControlChars.CrLf}, _
StringSplitOptions.RemoveEmptyEntries)
For Each Item As String In URLFile
If Item.StartsWith(ITEM_URL) Then
Navigate(Item.Substring(ITEM_URL.Length))
Exit For
End If
Next
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Internet Favourite (*.url)|*.url|All files (*.*)|*.*"
Save.CheckPathExists = True
Save.FileName = wbBrowserTab(currentTab).DocumentTitle
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.CreateText(Save.FileName)
myStreamWriter.Write(BLOCK_DEFAULT & vbCrLf & _
ITEM_BASEURL & wbBrowserTab(currentTab).Url.ToString & vbCrLf & _
BLOCK_INTERNETSHORTCUT & vbCrLf & _
ITEM_URL & wbBrowserTab(currentTab).Url.ToString)
myStreamWriter.Flush()
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Dim Response As MsgBoxResult
Response = MsgBox("Are you sure you want to Exit Web Browser?", _
MsgBoxStyle.Question + MsgBoxStyle.YesNo, _
"Web Browser")
If Response = MsgBoxResult.Yes Then
End
End If
End Sub
Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
txtURL.Cut()
End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
txtURL.copy()
End Sub
Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
txtURL.paste()
End Sub
Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
txtURL.selectall()
End Sub
Private Sub GoToToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToToolStripMenuItem.Click
Navigate(txtURL.Text)
End Sub
Private Sub HomeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HomeToolStripMenuItem.Click
WebBrowser1.GoHome()
End Sub
Private Sub txtURL_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtURL.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(txtURL.Text)
End If
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
Me.Text = "Web Browser - " & WebBrowser1.DocumentTitle
txtURL.Text = WebBrowser1.Url.ToString
status.Text = e.Url.ToString()
Me.Text = WebBrowser1.DocumentTitle & " - Web Browser"
ProgressBar1.Visible = True
End Sub
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
ProgressBar1.Value = CInt(e.CurrentProgress)
End Sub
End Class
———
https://www.codeproject.com/KB/recipes/IE7_Clone_VS2005_Browser.aspx
———
Dim mine As New one()
mine.TopLevel = False
Dim t As New TabPage
t.Controls.Add(mine)
mine.TopLevel = False
TabControl1.Controls.Add(t)
TabControl1.SelectedTab = t
mine.show
———
How can I display a form within another form (area) without make one of them MDIParent and the other one MDIChild?
Solution:
Dim f As New frmEmbed2()
f.TopLevel = False
Me.Controls.Add(f)
f.Show()
this works because a form descends from the Control class, and which means you can place it in the Controls collection of another form
———
Q: What is an MDI Form?
A: Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window.
Q: How do I create an MDI Parent form ?
A: In the Properties window, set the IsMDIContainer property of the form to True.
Or, to get a predisgned MDI Form, which includes a MenuStrip, ToolStrip and StatusStrip, simply add a new Windows form, and
in the displayed dialog box select MDI Parent.
Q: How do I create an MDI child Form?
A: Add a new Windows Form (so that you have 2 forms). In the MDI Form's Form_Load event, type the following :
Dim MDIChildForm As New Form2()
MDIChildForm.MdiParent = Me
MDIChildForm.Show()
Q: How do I change the Background color of an MDI Parent form?
A: Eventhough there is a BackgroundColor property in the Properties Window, it will not work as expected. Select the BackColor property in the Properties Window, and set it to a different color. You will not see the color of the MDI Form change in the Form designer. You have to type the following code into the MDI Form's Load event as well:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ctl As Control
Dim ctlMDI As MdiClient
' Loop through all of the form's controls looking
' for the control of type MdiClient.
For Each ctl In Me.Controls
Try
' Attempt to cast the control to type MdiClient.
ctlMDI = CType(ctl, MdiClient)
' Set the BackColor of the MdiClient control.
ctlMDI.BackColor = Me.BackColor
Catch exc As InvalidCastException
' Catch and ignore the error if casting failed.
End Try
Next
End Sub
Q: How do I add a Background picture to the MDI Parent form?
]A: Select the BackgroundImage property of the MDI form, click the ellipses button that appears next to it, in the Select Resource dialog box, select Import.. and browse to the particular picture you want and click OK.
The picture will be tiled, once run.
Q: Are there any other display options for the MDI Form's Background Image?
A: Yes. Here are the options :
None - The image is left-aligned at the top across the control's client rectangle.
Tile - The image is tiled across the control's client rectangle.
Center - The image is centered within the control's client rectangle.
Stretch - The image is streched across the control's client rectangle.
Zoom - The image is enlarged within the control's client rectangle.
Q: How do I check if an MDI Child form already exists, so that we don't show the same form twice?
A: Inside the method from which you want to check (possibly a Menu item click, or toolbar) type the following :
For Each f As Form In Me.MdiChildren
If f.Text = "Form2" Then
MessageBox.Show("It already exists!")
Exit Sub
End If
Next
Dim f2 As New Form2
f2.MdiParent = Me
f2.Show()
Q: How do I find out which MDI Child form is currently active?
A: Inside the particular event (in the MDI form) type the following :
Dim ActiveMDI As Form = Me.ActiveMdiChild
MessageBox.Show(ActiveMDI.Text)
Q: How do I arrange MDI Child windows?
A: Here are the Mdilayout options :
Cascade
Inside the particular event of the control on the MDI Parent, type :
Me.LayoutMdi(MdiLayout.Cascade)
Tile Horizontal
Inside the particular event of the control on the MDI Parent, type :
Me.LayoutMdi(MdiLayout.TileHorizontal)
Tile Vertical
Inside the particular event of the control on the MDI Parent, type :
Me.LayoutMdi(MdiLayout.TileVertical)
Arrange Icons
Inside the particular event of the control on the MDI Parent, type :
Me.LayoutMdi(MdiLayout.ArrangeIcons)
———
https://www.vb-helper.com/