ddanbe commented: Helpful. +15
rproffitt commented: Starts up Peter Gabriel's Sledgehammer. Thanks. https://www.youtube.com/watch?v=g93mz_eZ5N4 +11
maybe:
dim box as new mult
@ ddanbe and @ rproffitt
Thanks guys.
Well, I am not on a network so I can't test if all instance of excel are going to be closed. However testing on my machine shows that: if you open more than one instance of excel through vb.net of directly starting excell all instances will be killed. To work out how many instance of excel your machine can see just convert the code I posted to:
Dim obj1(1) As Process
Dim counter As Integer = 0
obj1 = Process.GetProcessesByName("EXCEL")
For Each p As Process In obj1
counter += 1
Next
Debug.Print(counter.ToString)
End Sub
If you don't run an instance of excel the counter should be 0 which means also that either your machine is not running excel and no one else is running excel, hence you can kill all instances of excel. If you however not running excel and the counter >0 you need to find a way to only kill your instances of excel and there the process id comes in. Follow the link I posted.
The sledgehammer method would be to close all excel processes. This can be done with:
Dim obj1(1) As Process
obj1 = Process.GetProcessesByName("EXCEL")
For Each p As Process In obj1
p.Kill()
Next
However, if others are also using excel , their processes will also be killed.
Reference the this discussion:
http://stackoverflow.com/questions/11761379/excel-process-still-runs-after-closing-in-vb-net
Thereare a few videos you can follow and see if it gives the required result:
https://www.youtube.com/watch?v=FPBMoibAmU0
https://www.youtube.com/watch?v=vQhjnMxRuGs
You need to show the code where the error happens.
O.K instead of textboxes you declare some strings. Instead of a listbox(see your line 20 in the original post) you use a list(T) of string and proceed(and I use my post but Jim's is doing the same) but hold the original string in memory. Now you get your field from the database and see if that string from the database is contained in the original string. If it is you loop through your list and upgrade the record, if it is not you loop through the list and add the record to the database.
Here I have used only your string in a textbox to sort your conditions out. Also notice that string.trim only trims one character.
So I successivly remove the parts you don'want and at the end move it into a listbox. You can than use the items in the listbox as your variables via selected item.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.Text = "D1*X584635*test.one*12643820000000000?*D2*65496321476=2416317950000000000*(Y@12345)*Date:*05*April*2016*Time:*17*01*32 #"
End Sub
Private Sub Work(sender As Object, e As EventArgs) Handles Button1.Click
Dim modifiedString As String = Replace(TextBox1.Text, "D1", "")
TextBox1.Text = modifiedString
modifiedString = Replace(TextBox1.Text, "D2", "")
TextBox1.Text = modifiedString
TextBox2.Text = TextBox1.Text.Trim({"#"c})
TextBox2.Text = TextBox2.Text.Replace("**", "*")
If TextBox2.Text <> String.Empty Then
TextBox2.Text = TextBox2.Text.Remove(0, 1)
End If
Dim parts() As String = TextBox2.Text.Split("*"c)
For Each item As String In parts
ListBox1.Items.Add(item)
Next
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class
You are using your type cast wrongly. Sender is a callback function:
http://stackoverflow.com/questions/11713250/vb-net-what-is-sender-used-for
Leave this out and you may use:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If TextBox1.Text.Contains("Aan De") = True Then
Dim wordString As String = TextBox1.Text
TextBox1.Text = Replace(wordString, "Aan De", "aan de")
ElseIf TextBox1.Text.Contains("Aan De") = False Then
TextBox1.Text = StrConv(TextBox1.Text, VbStrConv.ProperCase)
End If
End Sub
The publishing folder is where you put the setup.exe file. So a folder on the desktop will do. If you did read the links you will have found out that with the express edition you cannot easily determine the folder where your program installs. Another way is to go to the debug folder where you program is putting the files when you run from the development. There you should find a file where under type it says application. Click on this one and when it runs you can move it to the dektop, rename it with an exe extension and than move it where ever you want.
O.K. I just tried this process with one of my small programs. Click once applications don't create an exe file and they install into the user profile directory. However, if you goto start you should find your application there. Right mouse click gives you the option to se the properties. From there you can save the path and copy it into the task scheduler. Here are some links that will explain this in more detail.
http://stackoverflow.com/questions/2358910/how-to-allow-installation-in-a-custom-target-directory-and-suppress-auto-start
http://stackoverflow.com/questions/145400/how-do-i-dictate-the-destination-folder-of-a-clickonce-application
Also be aware using schduler on a network reuires admin rights.
Dear oh dear,
why don't you go to control panel -> uninstall a program and check if the file actually installed. There you can also search for the date of the installation of the program if it installed.
Have a look at this link. This might explain wgat you are looking for.
http://www.sevenforums.com/tutorials/57455-file-extension-icon-change-default-icon.html
Here I mostly used your code but added a list to store your strings and a listbox to display these.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim idList As New List(Of String)
Dim i As Integer = 1
Dim txtProps As String = ""
Dim objReader As New System.IO.StreamReader(propFileName)
ListBox1.Items.Clear()
If System.IO.File.Exists(propFileName) = True Then
Do While objReader.Peek() <> -1
txtProps = objReader.ReadLine()
idList.Add("Props " & i.ToString & ", PropId " & txtProps) 'add the properties to the list
i += 1
Loop
End If
'display strings in lisbox
For i = 0 To idList.Count - 1
ListBox1.Items.Add(idList.Item(i))
Next
End Sub
I would use a list of string to create the variables. No need to use redim statements:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.Text = "1" 'pevents error if textbox is empty
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim idList As New List(Of String)
ListBox1.Items.Clear()
'Create the variables
Dim j As Integer = CInt(TextBox1.Text) - 1 'need to take 1 as list stats at 0
Dim i As Integer
For i = 0 To j
idList.Add("Props" & i.ToString)
Next
'display variables in lisbox
For i = 0 To idList.Count - 1
ListBox1.Items.Add(idList.Item(i))
Next
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class
Well, the deliminator depends on the region for which your computer's system or program is set.
To only display the required digits use the math.round function:
Math.Round(value, 1)
https://msdn.microsoft.com/en-us/library/75ks3aby.aspx
You need to apply some division to the file.length as this comes in bytes based on the charcters in your file. Here are some of the divisions:
info.Length / 1024 '= kilobytes
info.Length / 1048576 ' =megabytes
info.Length / 1073741824 '= gigabytes
You need to check if th form does exist and if it does set the window.state to normal. Something like this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim frmCollection = System.Windows.Forms.Application.OpenForms
For Each f As Form In frmCollection
If f.Name = "Form2" Then
MsgBox("Form exists")
f.WindowState = FormWindowState.Normal
Exit Sub
End If
Next
Dim form2 As New Form
form2.Show()
form2.Name = "Form2"
form2.Text = "Form2"
End Sub
Looks more like a select case statement where there are more than one clause. See a good example of it here:
https://msdn.microsoft.com/de-de/library/cy37t14y.aspx
Well as I stated before, can create 9 small bitmaps and move these into the pictureboxes. That way you won't get any line and since it's always the same picture it doesn't really matter.
Since you are declaring snumber as string your inputbox statement should be:
sNumber = InputBox("Enter a number", "Numbers Only", iNumber.ToString)
https://msdn.microsoft.com/de-de/library/6z0ak68w%28v=vs.90%29.aspx
Well what you can try is to have another picturebox. Move each part into this picturebox, crop the edge off and than move it into the designated picturebox.
Well that is why I get the line which is part of a neihbouring part of the picture. That means division by 3 will be not exactly give the slicing.
Thanks ddanbe, will work on it when I get time again. Actually was just a matter of setting the forms doublebuffering to true and works like a charm now.
Well if it is always the same picture it just would be easier to load the numbers as single bitmaps into the pictureboxes. It can be split but needs fiddling to get the size of the initial picture correct for splitting. Now I am trying to find a solution for the resizing. And yes, it makes a difference.
O.K. that's what I came up with sofar but there is a flicker so I try to improve it.
Well again, is this always the same initial picture with the numbers or does this initial picture change? Is it always the same numbers that stretch and the corners stay the same? A user may change the window through pulling on the sides or corners. Is the scaling in the three events the same?
To find the line that throws the exception try the following:
On the menu bar in visual basic:
1) Click on the 'Debug' menu item
2) Click 'Exceptions...'
3) Select 'Common Language Runtime Exceptions' - 'Thrown'
This should stop the program at the line the exception is thrown in.
Ok this raises two questions:
1) Is this always the same image?
2)How do you want to resize the different parts of the picture? Button,Clicking on the part etc?
What should be the end product? Sliding game? It is hard to give good advice without knowing what the result should look like. Ayway one way of doing it is this,I only used three pictureboxes for demonstration:
Just click on the image to see the animation.
Public Class Form1
Private Sub Scale_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.PictureBox1.Size = New System.Drawing.Size(70, 70)
Me.PictureBox2.Size = New System.Drawing.Size(70, 70)
Me.PictureBox3.Size = New System.Drawing.Size(70, 70)
PictureBox2.Top = PictureBox1.Top
PictureBox2.Left = PictureBox1.Left + PictureBox1.Width + 4
PictureBox3.Top = PictureBox1.Top + PictureBox1.Height + 4
PictureBox3.Left = PictureBox1.Left
End Sub
Private Sub ScaleUp_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.PictureBox1.Size = New System.Drawing.Size(100, 100)
Me.PictureBox2.Size = New System.Drawing.Size(100, 100)
Me.PictureBox3.Size = New System.Drawing.Size(100, 100)
PictureBox2.Top = PictureBox1.Top
PictureBox2.Left = PictureBox1.Left + PictureBox1.Width + 4
PictureBox3.Top = PictureBox1.Top + PictureBox1.Height + 4
PictureBox3.Left = PictureBox1.Left
End Sub
End Class
Could you give us an example of what your foldername looks because I think you got something wrong in the get...
You really need to learn how to initialise your variables. You need an As and an intial value like:
dim num as integer= 0 or dim str as string= " "
If it is areference type you need to use the New keyword as in:
Dim bottomLabel As New System.Windows.Forms.Label
Here is a good reference to start you off:
https://msdn.microsoft.com/en-us/library/7ee5a7s1.aspx
In your case I think it just means that you have to put the as clause at the enf of your function like:
Public Function getFolderNameGD(ByVal fullyQualifiedFolderName As String, ByVal searchPattern As String) As String
Assuming you got the image in a picture box you can simple do something like this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.PictureBox1.Size = New System.Drawing.Size(140, 70)
End Sub
First put option strict on, this might throw more error msg.
I do think crop is not the way to do what you want. Look into split image.Maybe you just want to overlay lines?
Well the first line tells you:
System.NullReferenceException: Object reference not set to an instance of an object.
Which means you are referring to an object without having it declared.
HAve you got option strict on and infer off? This will mostlike flag the error, depending on the error meg settings for your project.
It is not very clear what you attempt to do. In your example you replace a single word, in your for each loop you replace all(?) text.
Also you should use something like:
For Each lbItem As string In ListBox1.Items
TextBox1.Text = Replace(TextBox1.Text, lbItem, "{HIDDED}")
Next
You also need to add like this:
ListView1.Items.Add(Me.txtDescription.Text).SubItems.Add(Me.txtPrice.Text)
Just search dani web with your query as there are lots of answers.
Here the frame is in action
It's hard to understand what exactly you want to do. However, to put a fframe around the chart you use:
Chart1.BorderSkin.SkinStyle = BorderSkinStyle.FrameThin1
and you can play around with different frames.
O.K. another way is to use the properties of the chart. Set BorderlineColor to black, BorderlineDashStyle to solid and than you can change the line thickness of the border
First of all get rid of the semicolon after 3
Spaces in these names are problematic and there are different ways of dealing with it:
http://stackoverflow.com/questions/14190798/how-to-select-a-column-name-with-space-between-in-mysql-on-liunx-ubuntu
Why would you want to load form1 again? Anyway it works for me without an error.
Try:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim myform As New Form
myform.Show()
End Sub
Maybe also replace line 29: If Len(Trim(txt.Text)) Then with
If Len(Trim(txt.Text)) > 0 Then
Well Don, if you want the group to improve on your app you have to show us the code.
Well with tabcontrols you also have to select the pages of the control you want to work with. Also you need to add columns to a datagridview before you can add the rows. So here is a small application to show you how to it. I move text from form1 to all other pages in form1 and form2 and create a populate a datagridview on form2 form form1.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.Text = "Hello"
Form2.Show()
End Sub
Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click
End Sub
Private Sub Exit_Click(sender As Object, e As EventArgs) Handles Button1.Click
Application.Exit()
End Sub
Private Sub Transfer_Click(sender As Object, e As EventArgs) Handles Button2.Click
'To work with the tabcontrol you need to select it and also
'the page of the control
Dim selectedTab As TabPage = TabControl1.SelectedTab
Dim selectedIndex As Integer = TabControl1.SelectedIndex
TabControl1.SelectedTab = selectedTab
Dim str As String
str = Me.TextBox1.Text 'Textbox in form1,tabcontrol1,page1
'Page indexes are 0 based
If TextBox1.Text.Length > 0 Then
'here we select Textbox2 in form1,tabcontrol1,page2
TabControl1.SelectedTab = TabControl1.TabPages(1)
TextBox2.Text = str & "Page2" 'transfer text from page 1 to page2
'next select form2,tabcontrol1 in form2, and page1 of thetabcontrol
Form2.TabControl1.SelectedTab = Form2.TabControl1.TabPages(0)
'transfer text to textbox in tabcontrol on form 2,page 1 textbox1
Form2.TextBox1.Text = str & "Form2 Page1"
Form2.TabControl1.SelectedTab = Form2.TabControl1.TabPages(1)
'herewedothesameon tabpage2 on form2
Form2.TextBox2.Text = str & "Form2 Page2"
'now we deal with the datagridview1 on form2,in tabcontrol page 2
'You …
Any program can be started once windows has started by placing in in the startup folder under all programs in windows start.
http://windows.microsoft.com/en-us/windows/run-program-automatically-windows-starts#1TC=windows-7