|
Can you not use the diagnostics name space to query the process counters memory utilisation for your application?
Don't know how accurate it would be, but at least it is a start!
|
|
|
|
|
hi,
I have tried this and am sure i have done this before however i cannot think of the code needed.
All i want to do is copy the contents of textbox1 in form1 into textbox2 into form2
i am using a timer on form2. so on form2 load this is the code
i thought the code was textbox2.text = my.forms.form1.textbox1.text
however this does not work
please help me
thanks
|
|
|
|
|
I take it then you are wanting the code to be run in Form2 (on a button push for example, to retrieve the contents of form1.textbox1? as opposed to the form1 setting the text box on form2?
|
|
|
|
|
The code below will check the application open forms collection to make sure it is open, then it will copy the text across. You could modify this to raise an error/message to the user to say the form is not open etc.
Dim otherForm As Form1
For Each item As Form In My.Application.OpenForms
If item.Name = "Form1" Then
otherForm = item
TextBox1.Text = otherForm.TextBox1.Text
Exit For
End If
Next
|
|
|
|
|
thanks Dave for the reply!!
I tried your code however it didn't seem to copy the contents of textbox1 in form1 into textbox2 in form2?
I am using a timer, what i am initailly doing is checking the serial of the computer in one text box and then comparing it with another one in another form.
|
|
|
|
|
I don't know the specifics of what you are trying to do or where the timer is residing etc.
The code does work if placed in a button event on Form2 and you have both forms (with names Form1 and Form2) open, and your textboxes are both named textbox1 on each form
Would need to know more about your specific scenario to write code for what your trying to achieve, but surely with the information i have provided you can work out what is going on and solve you specific problem?
|
|
|
|
|
hi, expert
I want to export my all data listview control into pdf file.
ex. suppose i fetch my all data from database into listview and after that i want to export all data into pdf file formate in vb.net.
i hope u understand my querry.
|
|
|
|
|
In order to do that you will need to make use of a PDF Library. There are several free ones, simply google for pdf library and take your pick.
Be warned though, they are not always easy to use.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
I am programming in VB2005
I am populating combobox on load event as following:
Dim dt As DataTable = ...
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "MODEL"
ComboBox1.ValueMember = "MODEL"
The problem is the ComboBox1_SelectedIndexChanged event fired.
I would like to prevent the event to fire at load.
I know that I can use flag or addhandler after populating to solve this problem but I would like to know if there is any combobox property or method that prevent this event to fire when populating the combobox by databinding?
Thank you.
Shay Noy
|
|
|
|
|
shaynoy wrote: I would like to prevent the event to fire at load.
You can't.
shaynoy wrote: I know that I can use flag or addhandler after populating to solve this problem but I would like to know if there is any combobox property or method that prevent this event to fire when populating the combobox by databinding?
No.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have created a few textboxes. Input may only have numeric values.
If char.isnumeric(e.char) then
else
end if
But if a letter is entered, the error I created is given, but after the letter is visible in textbox also.
How can this be done, that only the numeric values are shown?
Thanks in advance
|
|
|
|
|
You can use TextChanged event of your textbox for checking if the text entered conatins no numeric characters. If there is specific format of the account numbers, look into masked textbox.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I know, I checked this in keypress, but I want that the letter values aren't shown in textbox after the msgbox occures.
Like:
If Char.IsNumber(e.KeyChar) then
'Show numeric values
Else
'But here letter value is showed
MsgBox ("Please enter a numeric value: " ,vbinformation)
tb500.Focus
Exit sub
End If
Thanks
|
|
|
|
|
Well, do what I told you. Your code is broken for two reasons
1 - it doesn't cancel the unwanted keypress
2 - it doesn't let the user use the arrows or delete keys
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
As CG said, you have not cancelled the last key press. Along with this, take care of the case when user paste's anything in the textbox both trough mouse and keyboard.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I understand what to do, but since I use vb.net only for a few weeks (I always used vb6, other solution for this problem), can you help me with this code
Thanks
Luc
|
|
|
|
|
Nobody who can help me please?
|
|
|
|
|
Luc Baetsle wrote: But if a letter is entered, the error I created is given, but after the letter is visible in textbox also.
What error ?
You should also use char.IsControl to check if it's a backspace, etc. And if it's neither, set the Handled property of the eventargs to true. I believe you need to do this in the KeyPress event.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
That wont fire in case user pastes text in the textbox through mouse.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I didn't know that, but, either way, any code that turns text into a number should use tryparse, and if that's the case, some extra code should be written to deal with it, but the KeyPress event is the best way to handle the user typing into the control.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: some extra code should be written to deal with it
And where would you write that? In the TextChanged or the MouseDoown event, hence what I feel is, it is better to keep the check in one place instead of two.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Well, you could do it all in TextChanged, but at that point, you have ALREADY accepted an unacceptable character, therefore, this solution is unacceptable if you want a clean implimentation, where pressing a letter or other non number/non control character, just does nothing.
Every implimentation I've ever seen, does it the way I'm suggesting. I don't even bother handling mouse pastes, if people want to do that, that's their fault. My code will still detect a non number and show a message accordingly.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Why not in keypress event? Or will a copy / paste not be recognized then?
|
|
|
|
|
Text box named "origens"
Use this code
Private Sub origens_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Then ' Rejects all ascii < 0.
KeyAscii = 0
Else
If KeyAscii > 57 Then
KeyAscii = 0
End If
End If
End Sub
|
|
|
|
|
Private imageArray() As Image
For i = 0 To List1.Items.Count - 1
imageArray(i) = Image ' Image is a Image which format is metafile
Next
The above code work properly but imagearray() is not storts images data.
So the error is generated on imagearray(i).width.
error is "Parameter is not valid"
Thanks
If you can think then I Can.
|
|
|
|