|
Hello,
I am trying to assign a class to another whose types are different. (please do not say ctype, it will not work)
Consider that the following class below
public Class time
public hour as byte
public minute as byte
public second as byte
end class
I want to assign a DATE to this class
e.g
dim i as new Time
i = Today.Now 'Time=Date
When I do that, I want the compiler to call a method, which will allow this conversation
e.g
Sub A_Sub(value as object)
if typeof value is date then
me.hour = value.hour
me.minute = value.minute
me.second = value.second
end if
end Sub
How can I do that? I think i need to use ExpandableObjectConverter class but not sure
Please help
Thank you
Best Regards
Emre YAZICI
|
|
|
|
|
Apparently, VB.NET does not allow operator overloading ( C# does ). That's what google told me, anyhow. Operator overloading is the facility you need to do what you're trying to do here. If VB.NET does support it, please let me know, because otherwise, I'm going to tell every person who tells me VB.NET is the same as C# that this is one more thing that C# does and VB.NET doesn't. I hope for your sake I am wrong, because without it, you're basically screwed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian is, grudingly, correct. VB.NET 2002 and 2003 don't support operator overloading, which is what your trying to do. This is no longer a problem in 2005.
The are ways around this little issue though, such as:
Public Class myTime
Private hour As Byte
Private minute As Byte
Private second As Byte
Public Sub New(ByVal value As Date)
Me.hour = value.Hour
Me.minute = value.Minute
Me.Second = value.Second
End Sub
End Class
Dim i As myTime(Date.Now())
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello,
how can I compare two HTML files and know if there text contents has changed and highlight the changes.
|
|
|
|
|
|
BUSINESS OBJECTS CAN TAKE THEIR CRYSTAL REPORTS AND SHOVE THEM UP
THEIR ASS, ALONG WITH OTHER "BUSINESS OBJECTS". THEIR PRODUCT IS AWESOME
BUT THEIR SUPPORT IS GARBAGE. ANYONE OUT THERE THINKING ABOUT USING
CRYSTAL REPORTS, THINK AGAIN. I HAVE SPENT THE LAST 3 WEEKS TRYING TO GET
SUPPORT TO ANSWER ONE TINY QUESTION AND ALL I GET IS A LINK TO AN EXAMPLE EVERYONE,
IN THE FREE WORLD HAS SEEN, OR "USE THE VB IDE HELP". SO F!@#$ BUSINESS OBJECTS AND THEIR CRYSTAL REPORTS!!!!!!!
SORRY FOR THE NEGATIVITY, I HAD TO RELEASE SOME COMPUTER STRESS, AND WHAT BETTER WAY TO DO THAT THEN SPEAK OUT ON A FORUM.
|
|
|
|
|
trust me... many people feel your frustration. a few years back we developed a packing and shipping application in which we decided to use crystal to generate our packing slip. sometimes i would spend 3-4 days trying to get the data to display properly only to get the descriptive "General Error" or "Report Load Failed". This is, imho, the big problem with Crystal. The real problems are hidden behind these generic errors. At least that's my experience.
Eventually, if you are patient enough you'll get it.
Do you have a specific problem that you're trying to work through, or are you just speaking in general?
-jim
|
|
|
|
|
i want to know if it is possible to set a timer to display a label for a while depending on the interval we set.
and when the interval ends , show up another label object.
|
|
|
|
|
Use the Timer class in System.Threading namespace.
|
|
|
|
|
i tried using it.
but slightly confused here as which member property to use....
can u send me a sample code...
|
|
|
|
|
|
well... i am not using window forms...but asp.net web application...
so... how to do in that ....
pliz suggest...
|
|
|
|
|
In that case, you're going to have to ask in the ASP.NET Forum. But, ASP.NET won't do this, since it is a server-side technology that generates HTML for browsers. What you want to do is entirely client-side and hence will have to be written in JavaScript.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In that case it sounds like you need a banner (also called AdRotator). You should be able to get plenty of code examples if you post your question in the asp.net forum.
|
|
|
|
|
Hello,
I’m rather new to VB.NET and was hoping someone could explain to me how to capture mouse and keyboard events in an application that is running in the system tray. It seems that minimized and trayed apps don’t catch event unless they have focus. What is the work around?
Thank you,
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
A global keyboard/mouse hook is what's required. VB.NET may be capable of this, as it's able to import API functions. In the end, C or C++ code will do the real work, as usual.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What do you mean "may"? Application.AddMessageFilter()[^]
Picking up the pace of your VB bashing?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
What do you mean "may"? Application.AddMessageFilter()[^]
Correct me if I am wrong, but this seems to be a message filter for the application in question. How will that catch global keyboard and mouse messages when the app in question is minimised ? Or do I have it wrong ?
Dave Kreskowiak wrote:
Picking up the pace of your VB bashing?
*grin* I was astounded in the face of a recent 'name one thing that VB.NET can't do that C# can do' conversation recently ( the person in question was plainly obtuse, he rejected both the 'using' keyword and pointer access as valid examples ), to find out today that VB.NET does not yet support operator overloading. Perhaps that coloured my frame of mind.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I seem to remember Heath saying that it works, but I can't remember when or in which Forum...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Fair enough. I'd be interested to know, seeing as I may well use it at some point in C#. I'd be surprised if it intercepts messages for all applications though ( which is what you're saying ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i would like to know how to compare date in ASP.NET Web Application..??
the prob is that we are using Oracle as the database..which uses date as DD/MM/YY format while VB.NET uses MM/DD/YY format,..
so how to cope with these two diff formats ??
|
|
|
|
|
VB.NET doesn't use any particular date format. The default dateformat is determined by the system, not VB.NET.
You should be comparing two Date objects, not two Strings of text representing the dates. Convert your data from the database, as well as the compare date, to Date objects and use the .CompareTo() method of one of them to compare it to the other.
Dim dt1 As New Date(2005, 2, 12)
Dim dt2 As New Date(2005, 3, 21)
Dim result As Integer = dt1.CompareTo(dt2)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ya Mr. Dave..
the system date that we tried to enter into the Oracle database through "Today.date.date" is not being entered into the database,,..
wat can be the prob... and so how shud we enter the system date in the database ??
|
|
|
|
|
Without seeing your code, it's impossible to tell you what your doing wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I run into this all the time in my CIS349 and CIS 405 classes. In fact I just emailed a student of mine about a similar problem.
use the oracle to_date or to_char functions.
in SQL:
select * from orders where orderdate between to_date('01/23/2005', 'MM/DD/YYYY') AND to_date('02/23/2005', 'MM/DD/YYYY')
for the reverse....
select to_char(orderdate, 'MM/DD/YYYY') from orders;
In the latter version when you get your data back from the db into your data container you will already have it in the right format.
http://www.jasncab.com/huberblog :: Jason Huber
|
|
|
|