You are probably better off moving the question to asp web development in Dani
You are probably better off moving the question to asp web development in Dani
This snippet should give you an idea of how to work the difference out:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str As String = ""
Dim format As String = "HH,mm"
Dim diff As TimeSpan
Dim constSt As TimeSpan = New TimeSpan(0, 8, 0, 0, 0) 'Constant start Time
Debug.Print(constSt.ToString)
Dim start As TimeSpan = TimeSpan.Parse(Now.ToShortTimeString) 'actual start time
diff = start - constSt 'difference in hours,minutes,seconds
Debug.Print(diff.ToString)
End Sub
So how have you started to solve your homework question? Humor us and show some code and explain your thoughts of how to solve the task.
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 …
You need to tell which controls are in your groupbox and what you want to print,
text, pictures buttons, button.names etc.
Maybe the lines in your textbox are wrapped? Make your listbox wider and see if you have all the txt there.
Reverend Jim has given you a pointer already. You need to store the row numbers that are colored and retrieve these when loading.
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
Well, show the code you have sofar,
otherwise put your copying code between lines 2 and 3:
For Each row As DataGridViewRow In DataGridView1.Rows
'Put your code here
DataGridView1.RowsDefaultCellStyle.SelectionBackColor = Color.Red
Another method would be:
Set: SelectionMode to FullRowSelect of your datagrid
Private Sub DataGridView1_CellMouseDown(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDown
For Each row As DataGridViewRow In DataGridView1.Rows
DataGridView1.RowsDefaultCellStyle.SelectionBackColor = Color.Red
If e.RowIndex > -1 Then
DataGridView1.Rows(e.RowIndex).Selected = True
End If
Next
End Sub
@ Jim
Now you are starting answering 6 years old posts. Trolls on Dani? There wasjust one answer to a question from 10 years ago.
O.K. I just played around with it. In Solution Explorer make sure you have selected Any CPU as target. Then I put, just for testing, this line on top of form1.load:
Private oskProcess As Process
and just called in form load:
Process.Start("osk.exe")
which worked fine when running the exe.
Can you find out which line throws the error?
No worries, happend to me a few times lately.
Cheers
To print what you see in your rich textbox find the code here:
https://msdn.microsoft.com/en-us/library/ms996492.aspx
This works fine for me on windows7 64 bit:
Private Sub TextBox1_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseClick
Process.Start("OSK.EXE")
End Sub
There is some code for manipulation of the keyboard here:
http://hot-virtual-keyboard.com/development/q1/
I believe it is not possible to place it within a form in vb.net as it is a part of the operating system like notebook. You might be able to use the position to place it over your form.
Just to check your system is o.k. copy OSK.EXE into the command line where it says "search programs and files" and start it from there outside of your program. If it works than there is something in your program preventing it from running. You might be able to run it without directory reference like:
Process.Start("OSK.EXE")
A typically example of trying to use a chunk of 300 lines of code without making an effort of understanding it and expecting others to to modify. I think not!
From your example I see that you want to get rid of the word go or Go. The best way to achieve this would be the string replace method. Just replace go or Go with "". You need to pay attention to: " Go "or "Go "or " go " etc. so you don't replace go within other words.
http://www.dotnetperls.com/replace-vbnet
You need to close the first connection to be able to open it a second time.
So show us the code that doesn't work for you. Tell us what you have tried, we are not mind readres. Also read the "Read Me" at the beginning of vb.net
Before anyone can help you make sure you have the listbox control set up to the condition you need, otherwise all the help is useless:
listview multiSelect = false,
view = details,
FullRow select = true,
HideSelected = False.
After you set all this up you might want to start off with this code snippet as it shows the index of the row you have clicked and returns the the item in the first column:
Private Sub ListView1_MouseUp(sender As Object, e As MouseEventArgs) Handles ListView1.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim index As Integer = 0
Dim str As String = ""
index = ListView1.FocusedItem.Index
str = ListView1.FocusedItem.SubItems(0).Text
MsgBox("Index " & index.ToString & " Item " & str)
End If
End Sub
What have you done sofar? Any code? Also how many days is the trial version working for? What do you want to display for the days before the ten days?
You like to elaborate which program you are talking about and what type of page?
Unicode character U+2640 called the female or venus sign. It will not do you any good in a notepad text file. Remember - this came from a unix program generated text and is probably a control character that is not understood by notepad and consequently the unix control character was mapped to a unicode character. If you want to keep it as is, don't delete the line it is in. You might as well insert a smily.
You are using the name the sheet and not it's index.
Example:
osheet = CType( obook.Worksheets.Sheets(2), Excel.Worksheet)
See if this works, otherwise you need to modify it.
You are welcome.
The code looks at each control in the form and if finds a textbook it executes the code.
So if you only have the 8 textboxes you don't need to address these in paricular, othrewise if you have other textboxes as well you have to address only the ones you want, but if the others would contain also letters besides numbers you are also o.k.
Error checking is always a must.
This code prints the sorted numbers to the debug.window and allows this way a quick check if everything worked as expected.
For i = 0 To numArr.Count - 1
Debug.Print(numArr(i).ToString)
Next
@ Mr.M
Why do you put Try Catch in the code but want to ignore any errors?
In my line 6 I should have checked that there are no spaces in a textbox via the spacebar and it would be better to trim the text as in:
If Len(Trim(txt.Text)) > 0 Then 'line 6
Otherwise thanks for the vote.
@Shark1
I don't understan your post. From my code you can see that I only add text from the textboxes with length > 0 so there are no blank elements in my list. I also change the type to Integer(well the OP didn't say what type of numbers he wants to sort. O.K. to check the validity of my code just make up 8 textboxes and add elements at form load like this:
TextBox1.Text = "12"
TextBox2.Text = "1"
TextBox3.Text = "2"
TextBox4.Text = ""
TextBox5.Text = "125"
TextBox6.Text = "12"
TextBox7.Text = ""
TextBox8.Text = "121"
Copy my other code in a button click event and run. The list only contains non empty entries and the sort is done on Intger values.
@Mr.M
Your comment is useless as Sanu also tries to sort text instead of numbers.
@ Sanu
As the OP stated he wants to sort numbers.
These few lines of code will do all this:
Private Sub Sort_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim numArr As New List(Of Integer) 'assuming integers
'here we add the textbox elements if they are not empty
For Each txt As Control In Me.Controls
If txt.GetType Is GetType(TextBox) Then
If Len(txt.Text) > 0 Then
numArr.Add(CInt(txt.Text)) ' assuming integers
End If
End If
Next
'here we sort these
numArr.Sort()
'here we check that all went well
For i = 0 To numArr.Count - 1
Debug.Print(numArr(i).ToString)
Next
End Sub
Sorry forgot to mention that you might be better off using a list of T or hashtable. Look at this link:
http://www.dotnetperls.com/list-vbnet
You are assigning either text to your array elements or nothing, that means if a textbox1.text="" then this element IntArr(0)="". So your array might look like this: "",3,7,"" etc. For sure if you return these elements there will be "" or 0 in it. So what you can do is remove all the empty array entries with removeat or you dont add these to your array, which means you don't assign the textbox.text directly to the array items but add these to the array. Also I can't see where you change the text to numbers, e.g. you are sorting text?
You might want to check out this code exsmple:
http://www.codeproject.com/Articles/21443/Winsock-Revamped
You said something different in your opening statement:
"PS: will use this as a mini chatting software between my friends"
So what is going to be?
What have you got on FORMAKRYESORE form ?
O.K almost there. To assign the discount you need a variable declared at formlevel - so you can set it in a sub and reuse it in your msgbox.
Public Class Form1
Dim Perc As String = ""
Then we go to your txtQty_TextChanged sub. Here we need to change the code to:
Private Sub txtQty_TextChanged(sender As Object, e As EventArgs) Handles txtQty.TextChanged
Dim num As Integer = 0
If txtQty.Text <> "" Then
num = CInt(txtQty.Text)
Debug.Print(num.ToString)
End If
If num < 5 Then
txtPay.Text = num * Val(txtPrice.Text) & "лв"
Perc = " 0%"
Debug.Print("0% ")
End If
If 5 <= num And num <= 9 Then
txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.05)) & "лв"
Perc = " 5%"
Debug.Print("5%")
End If
If 10 <= num And num <= 14 Then
txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.1)) & "лв"
Perc = " 10%"
Debug.Print("10%")
End If
If 14 <= num And num <= 99999 Then
txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.15)) & "лв"
Perc = " 15%"
Debug.Print("15% ")
End If
End Sub
With the debug.print statements you can check at any time values by printing these to the immidiate plane. So you can check that you get the correct values. We also assign Perc to the valid discount given.
Last we assign perc to a value in the msgbox:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MsgBox("???: …
With the percentages you need to pay attention because from your first post it wasn't clear what percentages you really want. I think you know where to change these likeL 0.05 = 5%, 0.1 =10%, 0.15=15% and 0.4 = 40%. I just put these according to your first post. For the pecentage display just make add something like & " 15%" to whee you want to displaa it.
That is to confusing for me. You need to show more code and explain what you mean by keyboard.
So what do you want to happen?
Can you be more clear about of what is going wrong? Also what do you mean by "created a keyboard in textbox1"?
Hey people maybe you check how old the posts are. This original one is 4 years old.
O.K. try this then:
Private Sub txtQty_TextChanged(sender As Object, e As EventArgs) Handles txtQty.TextChanged
If Val(txtQty.Text) < 5 Then
txtPay.Text = Val(txtQty.Text) * Val(txtPrice.Text) & "лв"
End If
If 4 < Val(txtQty.Text) < 10 Then
txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.05)) & "лв"
End If
If 9 < Val(txtQty.Text) < 15 Then
txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.1)) & "лв"
End If
If 15 < Val(txtQty.Text) < 99999 Then
txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.4)) & "лв"
End If
End Sub
The general method is:
Do While (ListBox1.SelectedItems.Count > 0)
ListBox1.Items.Remove(ListBox1.SelectedItem)
Loop
You might be also interested in this:
http://www.codeproject.com/Tips/170900/How-to-Delete-Selected-Items-of-ListView-and-ListB
Well in line 43 you have already a good start. You can use this to work out the discount. What have you tried?
Your formula is something like:
endprice=Val(txtQty.Text) * (price-(price*0.05)) for the 5%
So you want to display the discounted price, if there is one in
txtPay.Text ?
@ shark
No, she didn't write qty is order number but she wrote "qty is the number of times...."
@ jez9
Since your original questions has been answered by Jim you should close this thread as solved and open a new one with the new problem you are facing.
@ All of us
Since a lot of us are not native Englis speakers please write your questions as clearly as possible and also read questions and answer carefully. Otherwise threads will get endlessly long and confusing. Thanks