725 Posted Topics
Re: See if this helps. [CODE] Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick TextBox1.Text = DataGridView1.SelectedCells(0).Value.ToString End Sub[/CODE] Btw, the code from that link is for vb6, not vb.net. | |
Re: Loading a modal form, just like loading a MsgBox, it will stop all running code until that form is closed. Why not have your code within your modal Form and run the code right after you load this Form? | |
Re: Check out [URL="http://www.daniweb.com/software-development/vbnet/threads/348154/1479109#post1479109"]this thread[/URL] about using a BackgroundWorker to run code on a separate thread. .As for updating, try [ICODE]Application.DoEvents()[/ICODE] right after setting your progress. | |
Re: Check out [URL="http://www.daniweb.com/software-development/vbnet/threads/348499/1479684#post1479684"]this thread[/URL]. ![]() | |
Re: For vb6 questions, please use this forum. [URL="http://www.daniweb.com/software-development/visual-basic-4-5-6/4"]Visual Basic 4 / 5 / 6 Forum[/URL] Thanks. | |
Re: Even though this thread is Solved, hope this helps. Check out the first posted code from this link. [URL="http://stackoverflow.com/questions/234774/custom-button-captions-in-net-messagebox"]http://stackoverflow.com/questions/234774/custom-button-captions-in-net-messagebox[/URL] Just adding my 2 cents worth. I would personally create my own MsgBox clone from a Form since I can have total control over it. Also, use [ICODE].ShowDialog[/ICODE] instead of [ICODE].Show[/ICODE]. … | |
Re: Not quite clear. Could you provide just the needed info? | |
Re: >>Please tell me where i'm going wrong as the message box displays 0. [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click var = TextBox1.Text Form2.Show() End Sub[/CODE] For future references [B]@Kui[/B], start you own thread for your "own" questions. Thanks. | |
Re: See if this helps to check the Clipboard data for a valid URL. [CODE] If Clipboard.ContainsData(DataFormats.Text) Then '// check if Data in Clipboard is Text. Dim sTemp As String = Clipboard.GetData(DataFormats.StringFormat).ToString '// get Data. '// check if Data .StartsWith("http://") to make sure it is a URL '--- AndAlso check if … | |
Re: See if this helps. [CODE]Public Class frmMain Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub ' allows the TEXT BOXES to accept only numbers, the period, and the Backspace key Private Sub txtTest1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _ Handles txtTest1.KeyPress, … | |
Re: You could use this to get a specified line from the TextBox. [CODE]TextBox2.Text = TextBox1.Lines(2) '// get line 3.[/CODE] Or you could loop through all the lines. [CODE] For Each txtLine As String In TextBox1.Lines '// loop thru all lines in TextBox. If txtLine.StartsWith("leaning daniweb.com") Then '// check if line … | |
Re: See if this helps. [CODE] Dim myFileName As String = "C:\test.exe" IO.File.WriteAllBytes(myFileName, My.Resources.testApp) If IO.File.Exists(myFileName) Then Process.Start(myFileName)[/CODE] | |
Re: See if this helps. [CODE]Public Class Form1 '// Prices for the CheckBoxes as Decimal Arrays. Private myCoolCheckBoxPrices() As Decimal = {2, 3.5, 4.35, 1.75, 5, 9.99, 0.75} '// To get the value of the 3rd Array, since Index based, you would use: myCoolCheckBoxPrices(2) Private Sub Button1_Click(ByVal sender As System.Object, ByVal … | |
Re: See if this helps. [CODE]Public Class Form1 Private myCoolConfigFile As String = "C:\test.txt" '// your File to edit. Private arTemp() As String = Nothing '// String Array to load/modify/save File lines. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If IO.File.Exists(myCoolConfigFile) Then arTemp = IO.File.ReadAllLines(myCoolConfigFile) '// … | |
Re: >>then, how to put intcheckboxesChecked.tostring into a label or a textbox? Why not add it as you did in your original code, just following the For/Next loop? | |
Re: See if this helps. [CODE] ComboBox1.Items.Clear() '// clear for new input. For i As Integer = 0 To 99 '// since you will get more #'s that are greater than 9, use "If Not" first. If Not i < 10 Then ComboBox1.Items.Add(i) Else ComboBox1.Items.Add("0" & i) Next[/CODE] | |
Re: Can you provide a link to such a site? Should help with narrowing down a possible solution. | |
Re: See if this helps. [CODE]Public Class Form1 Private myFile As String = "C:\test.html" '// File for testing. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() '// send file lines as a Array. getLinks(IO.File.ReadAllLines(myFile)) End Sub Private Sub getLinks(ByVal htmlContentLines() As String) Dim iStartIndex, iEndIndex As … | |
Re: See if this helps to add a Toggle Button Control to the ToolStrip and respond as needed. [B]2 Forms, 1 ToolStrip(on Form1)[/B] [CODE]Public Class Form1 '// New CheckBox. (Appearance.Button changes a CheckBox to a Toggle Button) Public WithEvents cbNotes As New CheckBox With {.Width = 75, .Text = "Notes", .Appearance … | |
Re: See if this helps. [B]1 Button, 1 PictureBox[/B] [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click With PictureBox1 .Left += 5 .Top += 5 End With End Sub[/CODE] To change direction of movement, use [ICODE].Left -= 5[/ICODE], etc.. | |
Re: Check out [URL="http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/a5113a20-8c7f-4dc2-88de-a80239dfb406"]this link[/URL]. | |
Re: Use a ListView for Columns. [CODE] With ListView1.Columns '// add Columns. .Add("Process Name", 100) : .Add("User Name", 100) : .Add("CPU", 100) : .Add("Memory", 100) : .Add("Description", 100) End With ListView1.View = View.Details '// Display Columns. '// get Processes. Dim Prc As Process() = Process.GetProcesses For x As Integer = 0 … | |
Re: See if this helps to loop through the 2D Array. [CODE] Dim iMathsAverage As Integer = 0, iEnglishAverage As Integer = 0, iScienceAverage As Integer = 0 For i As Integer = 0 To StudentArray.GetLength(0) - 1 '// loop thru all Arrays. '// add values. iMathsAverage += CInt(StudentArray(i, 1)) iEnglishAverage … | |
Re: See if this helps. [CODE] MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath. MsgBox(IO.File.ReadAllText(TextBox1.Text & "test.txt")) '// for testing.[/CODE] When Debugging your project, it will use the bin\Debug folder. In this case, you will need to add your 2 folders to that directory. After publishing your application and having it install, make … | |
Re: If you need to get the byte count for a String, see if this helps. [CODE] Dim sTemp As String = "GetByteCount" MsgBox(System.Text.Encoding.UTF8.GetByteCount(sTemp))[/CODE] [ICODE]Note:[/ICODE] There are other types of Encoding other than UTF8. | |
Re: See if this helps. [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click UsernameKey("Visa") End Sub Private Sub UsernameKey(ByVal str As String) If str = "Visa" OrElse str = "Master" OrElse str = "Meps" Then MsgBox(str) End If End Sub[/CODE] Not sure why you were using … | |
Re: See if this helps. [CODE] If Not RichTextBox1.Text = "" Then '// if Not empty, add a New line and content. RichTextBox1.Text &= vbNewLine & TextBox1.Text & " - " & TextBox2.Text Else '// if empty, just add content. RichTextBox1.Text = TextBox1.Text & " - " & TextBox2.Text End If … | |
Re: Probably the best solution is to use a WebBrowser, especially if you need to login to your site. [URL="http://www.daniweb.com/forums/post1438157.html#post1438157"]This[/URL] should help to extract data from WebBrowser and if you need to login to a website, [URL="http://www.daniweb.com/forums/post1328780.html#post1328780"]this[/URL] should help. | |
Re: See if this helps. [B]2 Buttons[/B]. [CODE]Public Class Form1 Private LocationArray() As String = {"5,40,50,100", "75,125,30,45", "150,90,50,75", "75,40,180,25", "5,200,250,25"} Private penBlack As New Pen(Color.Black, 3) '// Default Color. Private penRed As New Pen(Color.Red, 3) '// Selection Color. Private arTemp() As String = Nothing '// .Split Locations Strings into(location.X, location.Y, width, … | |
Re: See if this helps to block a key from being typed into a TextBox. [CODE] Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(AscW("-")) Then '// check if "-" key has been pressed. '// ToolTip code here. e.Handled = True '// Cancel the … | |
Re: See if this helps. [B]5 ListBoxes(items in ListBox1)[/B] [CODE]Public Class Form1 Private arlGroup1, arlGroup2, arlGroup3, arlGroup4 As New ArrayList '// 4 ArrayLists to store random items. Private lstIndexes As New List(Of Integer) '// List to add random indexes to. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles … | |
Re: You could use a TabControl and remove the TabPages Headers. [URL="http://dotnet.mvps.org/dotnet/faqs/?id=tabcontrolremoveheaders&lang=en"]http://dotnet.mvps.org/dotnet/faqs/?id=tabcontrolremoveheaders&lang=en[/URL] Then use your btnNext/btnPrevious to scroll through the TabPages. [CODE] '// Next Tab. With TabControl1 '// if not last TabPage, go to next. If Not .SelectedIndex = .TabPages.Count - 1 Then .SelectedIndex += 1 End With[/CODE] [CODE] '// Previous … | |
Re: Even though this thread is Solved, I hope the following link will help others. [URL="http://www.daniweb.com/forums/post1349728.html#post1349728"]http://www.daniweb.com/forums/post1349728.html#post1349728[/URL] | |
Re: >plz give d code to me "Yes Sir!" :D See if this helps to check a ListBox if it already contains an item, if not add item. [B]2 ListBoxes[/B] [CODE]Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With ListBox1.Items '// add items for … | |
Re: >how to put an equation statement in a label?? [CODE] Label1.Text = (2 + 2).ToString[/CODE] | |
Re: Have you attempted this with the code provided in your [URL="http://www.daniweb.com/forums/post1464851.html#post1464851"]File wipe & drag-n-drop support[/URL] thread? By means of "a determined value", is that for file size or the content length in your file? | |
Re: >...I only started today so simple techniques... I think it was more difficult to try and come up with a easy to understand solution than to put the code together.:D **1 PictureBox, 3 Buttons**(Button2 is not used, but looks good:D) Public Class Form1 Private myCoolImagesFullPaths As New ArrayList '// Store … | |
Re: See if this helps with explaining a little about "SourcePath" and "DestinationPath". [CODE] If .ShowDialog = DialogResult.OK Then ' Load the specified file into a PictureBox control. PictureBox1.Image = Image.FromFile(.FileName) If IO.File.Exists(.FileName) = True Then '// check if file exists by using the FullPath of the file. IO.File.Copy(.FileName, "C:\MyPicture\" & … | |
Re: Also, see if this helps. [CODE] Dim myCoolColorDialog As New ColorDialog '// your Color Dialog. If myCoolColorDialog.ShowDialog = DialogResult.OK Then '// check if OK clicked. For Each ctl As Control In Me.Controls '// loop thru all controls on Form, if on another Form, use " In Form2.Controls", etc.. If TypeOf … | |
Re: See if this helps to change BackColor of items in a ListView. [CODE] For Each itm As ListViewItem In ListView1.Items '// loop thru all items. If itm.Text <= CStr(5) Then '// check if value is less than or equals 5. CStr = Convert to String, since using an Integer. itm.BackColor … | |
Re: See if this helps. [B]2 TextBoxes(MultiLine = True)[/B] [CODE]Public Class Form1 Private myCoolToonsFile As String = "C:\toons.txt" '// your File. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If IO.File.Exists(myCoolToonsFile) Then '// check if file exists. Dim arTemp() As String = IO.File.ReadAllLines(myCoolToonsFile) '// Load File in … | |
Re: Use the _TextChanged event and set the value as it is being typed in. [CODE] Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged '// check if numeric, then set new value for myCustomerTotalSpendingAllowed. If IsNumeric(TextBox1.Text) Then myCustomerTotalSpendingAllowed = CDbl(TextBox1.Text) End Sub[/CODE] | |
Re: See if this helps to save and load settings from a File. [B]2 CheckBoxes[/B] [CODE]Public Class Form1 Private myCoolSettingsFile As String = "C:\test.CFG" '// your settings.File. '// use Region when needing to group together portions of code. makes it easy to minimize the entire section and not one Sub at … | |
Re: See if this helps to check and compare the Date value in a MaskedTextBox. [B]1 MaskedTextBox[/B] [CODE]Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MaskedTextBox1.Mask = "00/00/0000" '// set Mask for Date Format. MaskedTextBox1.Text = "3 / 2/11" '// for testing. End Sub … | |
Re: [B]1.[/B] Give your Array a different Variable Name for each Array declared. [CODE] Dim arMyCoolTextBoxesArray() As TextBox = {TextBox1, TextBox2, TextBox3} Dim arMyOtherCoolTextBoxesArray() As TextBox = {TextBox4, TextBox5, TextBox6}[/CODE] [B]2.[/B] Use the same Array and just change the values. [CODE] Dim arMyCoolTextBoxesArray() As TextBox = {TextBox1, TextBox2, TextBox3} For i … | |
Re: [CODE] If CType(Form1.Controls.Item("CheckBox" & texton), CheckBox).Checked = True Then MsgBox("done") End If[/CODE] | |
Re: See if this helps to locate and select item in ListView. [CODE] For Each itm As ListViewItem In ListView1.Items '// loop thru all items. If itm.Text = TextBox1.Text Then itm.Selected = True '// select. itm.EnsureVisible() '// make sure item is visible. Exit For '// exit loop since item located. End … | |
Re: See if this helps. [CODE] If TextBox1.Text = Nothing OrElse TextBox2.Text = Nothing OrElse TextBox3.Text = Nothing Then MsgBox("TextBoxes CANNOT be Empty.", MsgBoxStyle.Critical) Exit Sub '// Skip the remaning code in the Sub. End If '// Save code here.[/CODE] | |
Re: See if this helps to save and load a image, then use it as BackgroundImage of a Form. [CODE]Public Class Form1 Private myFile As String = "C:\test.txt" '// your file to save/load image path. Private myLoadedImageFile As String = "" '// used to store FullPath of image loaded. Private Sub … | |
Re: For alphanumeric ID generator, see if this helps. [CODE] Dim myChars As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" '// Characters to use for ID. Dim myID As String = Nothing '// used to add random char. until the preset ID length. Dim idLength As Integer = 10 '// allow a 10 char. Alphanumeric … |
The End.