449 Posted Topics
Re: Ok, your question is really confusing. Could you explain it somehow better? If possible with a small example. | |
Re: Yes, this exception get raised if you try to access your controls from the backgroundworker. You can only access the controls from the thread, they were created on (so, the main thread) Hope the following example will explain it better: [CODE=vb] Imports System.ComponentModel Public Class BGW Dim BGW As BackgroundWorker … | |
Re: Data type mismatches mostly happens if you try to fill your dataset field with a value that is not of the type as in your database. In example you try to fill an image field into a Integer field. So please post the table definition and the query you use … | |
Re: why so complicated? Try this: [CODE=vb] Dim DestinationDirectory As String = "I:\New\Export\ID" Dim SourceDirectory As String = "C:\Temp2\" Dim overwrite As boolean = true my.Computer.FileSystem.CopyDirectory(SourceDirectory,DestinationDirectory,overwrite) [/CODE] | |
Re: If you just want to register a dll then try to use this: Start -> Run -> type in -> REGSVR32.EXE Path/to/dll to unregister: REGSVR32.EXE /u Path/to/dll | |
Re: You don't need to have two arraylists. Here is an example, how it would be better: [CODE=vb] Private Sub pop_combo_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim Jobs As New Dictionary(Of Integer, String) 'instead of this loop you do your data reading here For i As Integer = 1 … | |
Re: Using the InitializeComponent() procedure is the problem. Instead of using this method, you should create a custom method that will "reset" all your controls. On this way you are not overwriting the handlers of your controls event. If you use InitializeComponent() you actually create a new button for which a … | |
Re: You can do it on two ways. 1. you create a MDI form with a menustrip and add all your forms as MDI childs 2. You create 1 form with a menustrip and inherit all your forms from this form. so assuming you have created a form named "BaseForm" with … | |
Re: Password is a reserved word in every database. Use [Password] instead. With Username im not sure, so better use [Username] as well. | |
Re: If you really want to do that, then i would suggest to use a backgroundworker. Before starting this worker, you disable all controls that you need to disable and display the wait image. In the dowork event of that worker you do your sql query. In the work_complete event of … | |
Re: Here is a working example: [CODE=vb] Imports System.Text Public Class Form1 'Create the query Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim table As String = "testTable" 'whatever your table name is Dim columnCount As Integer = DataGridView1.Columns.Count - 1 'get the count of columns Dim sb … | |
Re: I would guess that the plugin/dll is not available as 64bit version. Have you tried to develop you application for x86 only? | |
Re: Yes, it is possible. Assuming your MDI Child is Form2: [CODE=vb] Public Class Form2 Private thisMenu As ContextMenu Private Sub Form2_Load(sender As Object, e As System.EventArgs) Handles Me.Load thisMenu = New ContextMenu Dim item1 As New MenuItem("entry1", AddressOf Item1_Click, Nothing) Dim item2 As New MenuItem("entry2", AddressOf Item2_Click, Nothing) thisMenu.MenuItems.Add(item1) thisMenu.MenuItems.Add(item2) … | |
Re: Actually if you want to transfer ALL items from one listbox to another then you can simple do that like the sample below. No looping needed. [CODE=vb] Private Sub MoveToBox2_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ListBox2.Items.Clear() ListBox2.Items.AddRange(ListBox1.Items) ListBox1.Items.Clear() End Sub Private Sub MoveToBox1_Click(sender As System.Object, e As System.EventArgs) … | |
Re: Maybe this is something you look for: [CODE=vb] Public Class Form1 Private DefaultStyle As DataGridViewCellStyle Private Sub DataGridView1_CurrentCellDirtyStateChanged(sender As Object, e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged If DataGridView1.IsCurrentRowDirty Then DataGridView1.CurrentRow.DefaultCellStyle = New DataGridViewCellStyle With {.BackColor = Color.Red, .ForeColor = Color.White} Else DataGridView1.CurrentRow.DefaultCellStyle = DefaultStyle End If End Sub Private Sub Form1_Load(sender … | |
Re: You could try something like this: [CODE=vb] Dim DummyParameters() As String = New String() { If(tbx_transaction_id.Text = "", Nothing, String.Format("trans_id='{0}'", tbx_transaction_id.Text)), If(tbx_cust_id.Text = "", Nothing, String.Format("customers.cust_id = '{0}'", tbx_cust_id.Text)), If(tbx_amount.Text = "", Nothing, String.Format("trans_amount = '{0}'", tbx_amount.Text)), If(tbx_name.Text = "", Nothing, String.Format("fname='{0}%' or lname='{0}%'", tbx_name.Text))} Dim finalParameters As IEnumerable(Of String) … | |
Re: Here is an example that will copy all "jpg" files, found in one directory, to another directory. [CODE=vb] Dim overwrite As boolean Dim destinationFolder As string = "C:\Users\GeekByChoiCe\Desktop\dump" Dim files() As String = IO.Directory.GetFiles("C:\Users\GeekByChoiCe\Desktop\myhouse", "*.jpg",io.SearchOption.AllDirectories) Array.ForEach(files, Sub(sinfleFile As String) io.File.Copy(sinfleFile,io.Path.Combine(destinationFolder, io.Path.GetFileName(sinfleFile)), overwrite) End Sub) [/CODE] | |
Re: Yes, because you clear your textboxes, which raise the "TextChanged" Events. Just add a check to your "TextChanged" Events for Text being empty. this will solve your problem. | |
Re: set the property "ScriptErrorsSuppressed" of your webbrowser control to "true" | |
Re: I think the "CheckForIllegalCrossThreadCalls = False" causes the strange things happens. Definition of CheckForIllegalCrossThreadCalls: [QUOTE]Gets or sets a value indicating whether to catch calls on the wrong thread that access a control's Handle property When a thread other than the creating thread of a control tries to access one of … | |
Re: what code you have so far? Please show some effort first. Thank you. | |
Re: I don't know what the difference is between ans1 and TextBox1 so i just ignored that. Here is a complete code for your guessing form: [CODE=vb] Public Class Form1 Dim guess As Integer Private Sub StartGame() Dim generator As New Random ran1.Text = CStr(generator.Next(1, 100)) ran2.Text = CStr(generator.Next(1, 100)) ans1.Text … | |
Re: I assume you have "MySQL Connector Net" installed on your machine. So either you create a setup project and add this to your pre-requirements OR you copy the MySql.Data.dll to your project, set its build action to none and also set it to "copy always". | |
Re: I don't know how you read in your settings file so maybe this gives you an idea: [CODE=vb] Dim dummy() As String = New String() {"", "entry 1", "entry 2", Nothing, "entry 3"} ListBox1.DataSource = dummy.Where(Function(s) Not String.IsNullOrEmpty(s)).ToArray [/CODE] | |
Re: [CODE=vb] Dim fromFolder As String = IO.Path.Combine(My.Application.Info.DirectoryPath, "exc2") If IO.Directory.Exists(fromFolder) Then 'show the FolderBrowserDialog for destination folder End If [/CODE] | |
Re: maybe this helkps [url]http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx[/url] | |
Re: open your form in the design-view. Click F7 to get in to the code behind file. You have to create your procedure inside the Class. IE: (asuming your form name is Form1...) [CODE=vb] Public Class Form1 Private Sub CmdDisabl() Cmd_New.Enabled = False Cmd_Amend.Enabled = False End sub End Class [/CODE] | |
Re: Its actually not much work. Check this example: The Designer part: [CODE=xml] <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="MainWindow" Height="400" Width="600"> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.Resources> <HierarchicalDataTemplate DataType="{x:Type local:Dummy}" ItemsSource="{Binding Path=.}"> <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=ID}" /> <TextBlock Text=" - … | |
Re: use this: [CODE=vb]math.Round(12.5,0,MidpointRounding.AwayFromZero)[/CODE] | |
Re: Please provide us the connectionstrings and the code where the error occurs. | |
Re: something like this should work: [CODE=vb] Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load RecurseContainers(Me) End Sub Private Sub RecurseContainers(container As Control) For Each ctrl In container.Controls If TypeOf (ctrl) Is TextBox Then SetHandler(CType(ctrl, TextBox)) 'add handler to textbox Continue For End If If TypeOf … | |
Re: From what i see the problem seems to be: If OptionsForm.AutoSaveallOnExitCKB.CheckState I assume the OptionsForm is a Form, that is not initialized at that time. So the CheckBox AutoSaveallOnExitCKB is also not initialized. I would suggest to save the option "SaveOnClose" also in your My.Settings and check its value instead. | |
Re: something like this should do the trick... [CODE=vb] Private Sub TextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.Control AndAlso e.KeyCode = Keys.V Then Dim s As String = My.Computer.Clipboard.GetText.Trim If s.Length = 16 Then TextBox1.Text = s.Substring(0, 4) TextBox2.Text = s.Substring(3, 4) TextBox3.Text = s.Substring(6, 4) TextBox4.Text = … | |
Re: The "SetChildIndex" is the key. Check out this example: [CODE=vb] Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load 'create panel Dim imagePanel As New Panel With {.Width = 500, .Height = 500} Me.Controls.Add(imagePanel) 'create images Dim pictures() As String = IO.Directory.GetFiles("C:\Users\Public\Pictures\Sample Pictures") Dim x As Integer = 1 … | |
Re: instead of checking all the time the whole text you can use this code: [code=vb] Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Not Char.IsNumber(e.KeyChar) Then e.Handled = True End If End Sub[/code] this will allow only numbers beeing written in the textbox and ignores … | |
Re: Here is a working example [CODE=vb] Sub Main() If not CompareFiles("C:\Users\GeekByChoiCe\Desktop\dummy.txt", "C:\Users\GeekByChoiCe\Desktop\Backup") Then Console.WriteLine("file does not exist") Else Console.WriteLine("File already exist.") End If Console.Read() End Sub Private Function CompareFiles(newFile As String, oldDirectory As String) As Boolean Dim newFileMD5 As String = HashMD5(newFile) Dim oldFiles() As String = Directory.GetFiles(oldDirectory, "*", SearchOption.AllDirectories) … | |
Re: command.Parameters.AddWithValue("@stock_code", CType(e.Item.FindControl("stockCode"), Label)) You try to insert a Label in to your database? If not then change it to: command.Parameters.AddWithValue("@stock_code", CType(e.Item.FindControl("stockCode"), Label).Text) | |
Re: Use this code in your Form: [CODE=vb] Private Delegate Sub DelegateForSomeSub(ByVal arg0 As String) Public Sub SomeSub(ByVal arg0 As String) If Me.InvokeRequired Then Me.Invoke(New DelegateForSomeSub(AddressOf AppendText), arg0) Else AppendText(arg0) End If End Sub Private Sub AppendText(arg0 As String) TextBox1.AppendText(arg0) End Sub [/CODE] | |
Re: Oh please .... don't ask for code if you don't show any effort first. Post what code you have so far and tell us where you stick. We are of course willing to help you but we are not going to code your stuff. | |
Re: You need a TCP Client/Server. Take a look at this: Server: [url]http://msdn.microsoft.com/de-de/library/system.net.sockets.tcplistener.aspx[/url] Client: [url]http://msdn.microsoft.com/de-de/library/system.net.sockets.tcpclient(v=VS.100).aspx[/url] | |
Re: execute your copy/move method in a separate thread. Set the max value of the progressbar to the original file filesize and update the progressbar to the copied file current size, using a timer. | |
Re: [CODE=vb] Dim plain As String = "130790" If plain.Length <> 6 Then Throw New FormatException("wrong format. Please use DDMMYY") End If Dim _date1 As String = plain.Insert(2, ".").Insert(5, ".") Dim _date3 As Date = Date.Parse(_date1) Console.WriteLine(_date3) [/CODE] | |
Re: After closing a Form it does not exist anymore. Create a new instance of the form. Dim F as new Form2 F.Show | |
Re: FirstName:=FirstNameBox.Text << ok Original_FirstName1:=FirstNameBox.Text << that won't work out You hand over the "updated" values as original values. Those of course does not exist in the dataset. | |
Re: [CODE=vb] Dim strOriginalWord As String = nothing Dim strPigLatin As String = nothing [/CODE] This will fix the green wavy line | |
Re: Try this: select * from (select Row_Number() over (order by [ID]) as RowIndex, * from [DB-Name].[dbo].[Table-Name]) as Sub Where Sub.RowIndex =10 | |
Re: The easiest and savest way is this: [CODE=vb] Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim tstan As TimeSpan If Not TimeSpan.TryParse(txtTime.Text, tstan) Then MsgBox("Please enter the time in format d:h:m:s") Return End If Timer1.Interval = 1000 Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As … | |
Re: the simplest way would be to surround your retrieve code with [CODE=vb] Try 'retrieve code here Catch ex as InvalidCastException Debug.WriteLine("Value is DBNULL") 'set value to $0.00 End Try [/CODE] | |
Re: Maybe that is what your are looking for: [CODE=vb]my.Computer.FileSystem.CopyDirectory("sourceDir", "destinationDir",false)[/CODE] | |
Re: Could you show us your code and what events you are talking about? |
The End.