|
how to write code to allow only numerics in vb.net
thax
|
|
|
|
|
|
Handle the keypress event and if char.isnumeric and char.iscontrol are both false for the char passed in on the event, set handled on the eventargs to true
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Ask your question in a new thread instead of as a reply in someone elses thread.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi
I have to print an html file, I want to rotate it by 90 degrees. I know how to take portrait and landscape reports.
I want to know how to rotate it by 90 degrees. Do you know how to do it????
(I should be resize I know that and I can do it)
Thanks!
jayasshc
|
|
|
|
|
Hello,
I’m working on a window application with visual studio 2005. Get the following error message.
Unable to copy file "obj\Debug\MyProject.exe" to "bin\Debug\ MyProject.exe". The process cannot access the file 'bin\Debug\ MyProject.exe' because it is being used by another process.
What I did is:
1. I just copied some staffs from another project. When I build it, the above message is displayed.
2. I restarted my computer and rebuild the project, the error disappears
3. I add more code on my project and build it, the error comes again
If you can give me any good suggestion, I will really appreciate it.
|
|
|
|
|
possibilities:
1) are you running the application outside the ide? check the taskmanager and make sure myproject.exe is not in the list before you do a build.
2) in the ide, run the app and stop it. does the task manager show anything of your app is still running? if so, then investigate why.
3) do you have references to projects/dlls that other applications might be keeping them open?
Nathan
|
|
|
|
|
Nathan,
Thank you so much for your replay. Your reply is really helpful for me.
I think my case is the second one you mentioned. Once I run my project, I found a myproject.exe is running in task manager. After I kill it, my project can be build. Even I close visual studio with my project. MyProject.exe is still running. Do you think what is the possible reason? How to avoid it?
Jane
|
|
|
|
|
1) do you have any loops? maybe you have a condition where you can't get out of one?
2) are you "cleaning up after yourself", release all objects properly.
3) any "shared" or "global" objects not being released when you shutdown your main form?
|
|
|
|
|
How to get the unique Serial number on usb flash drive()vb.net2005
I need your help, please! Thanks all..
gladys
|
|
|
|
|
http://www.codeguru.com/vb/controls/vb_shell/comments.php/c3049/?thread=39850
|
|
|
|
|
I have the need to write typed class that will hold single values as well as a collection of one value such as places lived. So I would have Name, Number, Income, Places Lived(multiple).
I have this done as a collection variable that holds the class with a .Add. When I try to set the value to the populated class in the code it says that the class cannot be converted to type Collections. What is the deal???
Cleako
|
|
|
|
|
cleako wrote: What is the deal???
If you were to post a skeleton of your class structure (the classes + public interfaces would be sufficient) it would make more sense.
cleako wrote: When I try to set the value to the populated class in the code it says that the class cannot be converted to type Collections. What is the deal???
I suspect that you are attempting to store an instance of the class PlaceLived into a Collection object, rather than create the collection and add the PlaceLived object to the collection.
|
|
|
|
|
Something like the following.
<br />
Public Class Person<br />
<br />
Private m_strName as String<br />
Private m_strNumber as String<br />
Private m_colPlacesLived as Collection<br />
<br />
Public Property P_Name as String<br />
Get<br />
Return m_strName<br />
Set (ByVal value as String)<br />
m_strName = value<br />
End Property<br />
...<br />
Public Property PlacesLived as Collection<br />
Get<br />
Return m_colPlacesLived<br />
Set (ByVal value as Collection)<br />
m_colPlacesLived.add(value)<br />
End Property<br />
<br />
End Class<br />
<br />
Public Class PlacesLived<br />
<br />
Private m_strAddress as String<br />
...<br />
Public Property PL_Address as String<br />
Get<br />
Return m_strAddress<br />
Set (ByVal value as String)<br />
m_strAddress = value<br />
End Property<br />
<br />
End Class<br />
That is the basic structure of what I am trying to do and when I set the values I do this.
<br />
Dim objPerson as new Person<br />
Dim objPlacesLived as PlacesLived<br />
<br />
objPerson.P_Name = "Name"<br />
<br />
For i as Integer = 0 to DataTable.Rows.Count - 1<br />
objPlacesLived = new PlacesLived<br />
<br />
objPlacesLived.PL_Address = "Address"<br />
<br />
objPerson.PlacesLived = objPlacesLived<br />
Next<br />
Any ideas??
Cleako
|
|
|
|
|
Your mixing types. your property is typed as a 'collection' but when setting a value to the property your using a 'placeslived'
make the property readonly return the collection
make a method to add a new placeslived to the collection.
|
|
|
|
|
cleako wrote: Set (ByVal value as Collection)
m_colPlacesLived.add(value)
You're adding a collection to m_colPlacesLived. Is this what you mean to do ? Or do you mean to make m_colPlacesLived = value ?
cleako wrote: objPerson.PlacesLived = objPlacesLived
Is PlacedLived a collection class ?
I'd expect you to just have a get accessor, because it returns a collection, which you can then call Add on, or Clear, or anything else. The setter is only needed if you want to pass an entire collection in. And if you want that, you don't want to use Add, you want to use =.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Ok Im completely lost now. Why would I use a Get only when I need the collection stored in that class?
Here is what I am trying to do, I want to see if I can successfully serialize the class into the XML I want and then I can add the beginning and ending tags as I need them. So I have multiple PlacesLived for example so I would have the Places_Lived_Data property which would hold multiple Places_Lived objects. I tried this morning to create a collection before I set it to the property and fill it with the objects there then I would set it equal to the property value which then tells me:
"To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. Microsoft.VisualBasic.Collection does not implement Add(System.Object)."
-- I think I found a solution. According to http://www.codeguru.com/forum/showthread.php?t=386776[^] I should be using Generic.List(Of PlacesLived) instead of Collection. That took care of the issue I was having and the XML output looks correct at first glance. Thanks!!!
I think I need the weekend to get here!
Cleako
-- modified at 8:03 Thursday 11th January, 2007
|
|
|
|
|
cleako wrote: Why would I use a Get only when I need the collection stored in that class?
because that returns the collection and you can then call methods on it, such as clear and add
cleako wrote: I think I found a solution
OK, great
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi there,
How do i make an arraylist available globaly. I know that the easy way is to make it a (Dare I say it ) Global variable.
|
|
|
|
|
you can make the variable shared within a class
public class Common
public shared oaArray as new arraylist
end class
-----
any code:
common.oarraylist.add("??????")
|
|
|
|
|
Thanks for that.
|
|
|
|
|
A global variable is the only way to make it available 'globally'. A better choice is to say 'who needs to see this, and in what context'. For example, can you pass it to the intended clients via a delegate ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christain,
using 'shared' will also make it available globally to the project and within referenced objects.
|
|
|
|
|
Of course it will - the point is, he knows it's a bad idea, so why not talk about alternatives ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
A global variable is the only way to make it available 'globally'. A better choice is to say 'who needs to see this, and in what context'. For example, can you pass it to the intended clients via a delegate
posted by Christian Graus - C+++ MVP
This is a good question
I have had a look and 8 out of 27 procedures need to see my Global Var.BTW I have put 3 more in there.
1 is a arraylist
1 is a string
2 are int.
A little info.
my application is a image viewing program, i ask the user to select the directory that they want to view...put the dir listing into a string and put the image names into the array. The rest of the program deals with displaying the images by clicking on verious menu's & buttons. Which is why i need global var. I split up the directory listing and display that if the user want too.
if there is an easier way to do this, i am open to ideas....just remember i am a newbie to VB2005 programming
|
|
|
|