|
I am a bit of a newbie and don't understand something... When you have a base class with a parameterized constructor you need to call mybase.new on the derived classes to instantiate the base class because the base class is called first which got me thinking if that was always the case even when there is no explicit constructor in the base class. So after fooling with a simple example I discovered that indeed it it is true, because even a non paramaterized base is instantiated when the derived class is called. So for example :
Class Fruit
Sub New()
Console.WriteLine("hello, im a fruit")
End Sub
End Class
Class Apple : Inherits Fruit
Sub New()
Console.WriteLine("hi, im an apple")
End Sub
End Class
the console would output both. My question is why? I don't understand why the base class needs to be created at all? Isn't it enough for a derived class to be created that has all the methods and fields of the base without creating a separate object just for the base class or perhaps I don't understand what is really going on behind the scenes.
If someone could enlighten me I would appreciate it.
Thanks,
Steve
|
|
|
|
|
When Apple inherits from Fruit, and you want to create an Apple, then you (or the system) create a Fruit, then specialize it into an Apple; you can't make an Apple that is not a Fruit. Everything you put into Fruit (data fields, methods, constructors) is available (not necessarily accessible) to derived classes as well. The constructor may initialize some data fields, so you need it to be called no matter what.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hi all genius people!
my app has picture boxes or labels moving through the whole
form in various directions. to do this i am placing the code
below to a timer of interval = 1 ms
pic1.left += some constant
pic1.top += some constant
when this constant is 1 the motion is quite smooth
but when this constant has a larger value say 5 then the motion
is rough
i tried using loops like this and placing it in the same timer
for x = 1 to 5
pic1.left += 1
pic1.top += 1
next x
but as my app has many pic boxes and
this timer runs for about 2 mins (=2*60*60*1000 ms)
this takes a lot of cpu
any ideas??
my sole intention is to make the motion smooth
thankx
TheMrProgrammer
|
|
|
|
|
The only way you're going to get smooth motion is to stop using controls to render all of your content, and even then, you might not get what you want, but it'll be a VAST improvement. You have to handle the Paint event of your form and draw all of your content yourself. Controls are too expensive to redraw and, from what I see if your small code snippet, you're not giving the form any time to redraw the controls in a timely fashion.
|
|
|
|
|
so you suggest to drop all the controls and stick to graphics object?
and/or i should increase the interval of the timer? to maybe 10 ms or what?
TheMrProgrammer
|
|
|
|
|
Hi,
1. a simple timer will not provide small steps such as 1 msec (see my timers article for details).
2. you don't need such small times anyway; a movie is built with some 24 frames per second, that is 40 msec per frame.
3. you do need double-buffering, so you don't see the building-up of each frame.
4. As Dave said, get rid of the Controls, paint it all to a single Panel.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hi,
i am doing customer details in vb.net 2.0 with ms access.
i have using customer name,address,city,mail id..
now i did saved all things.
but when i retrieve particular customer in textbox's.
address will printed continuously in tetxbox.
so i need to view line by line .
example,
12,NH road,
PSr Layout,
Chennai.
tis address view same format in textbox.
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
I see you are saving the address in a single DB column. Save '\n' too where ever you need one. Then while display it will be shown in new line.
जय हिंद
|
|
|
|
|
tell me some example for that..
input only thr multiline textbox
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
I'd suggest redesigning the database to hold the address as separate columns, and redesigning the GUI to use separate textboxes for each column.
It will pay dividends in the long run.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
I need to compare the dates with in a file and write the lines based on the latest date.
Code Sofar:
modified 28-Nov-12 8:11am.
|
|
|
|
|
Why not use DateTime.Compare method?
If you need to compare only the date part, then use DateTime.ToShortDateString() and then compare the strings.
जय हिंद
|
|
|
|
|
Thanks for ur reply.
If u check my code, u can find that i use .substring().
eg:
dateTime = temp.Substring(p(9), p(10) - p(9))
when i declare dateTime and dateTime1 as Date, i will not able to do the .substring...
any help will be helpfull...
|
|
|
|
|
Why do you need to use substring?
जय हिंद
|
|
|
|
|
to get the value within that particular range
|
|
|
|
|
Dim created, created1 As Date
...Lots of lines removed
baloon = temp.Substring(p(8), p(9) - p(8))
dateTime = temp.Substring(p(9), p(10) - p(9))
created = CDate(dateTime)
qty = temp.Substring(p(10), temp.Length - p(10))
While sa.Peek() >= 0
temp1 = sa.ReadLine()
name1 = temp1.Substring(0, p(1)) ', p(2) - p(1))
child1 = temp1.Substring(p(1), p(2) - p(1))
desF1 = temp1.Substring(p(2), p(3) - p(2))
desAF1 = temp1.Substring(p(3), p(4) - p(3))
desA1 = temp1.Substring(p(4), p(5) - p(4))
desAA1 = temp1.Substring(p(5), p(6) - p(5))
ecn1 = temp1.Substring(p(6), p(7) - p(6))
dnf1 = temp1.Substring(p(7), p(8) - p(7))
baloon1 = temp1.Substring(p(8), p(9) - p(8))
dateTime1 = temp1.Substring(p(9), p(10) - p(9))
created1 = CDate(dateTime1)
qty1 = temp1.Substring(p(10), temp1.Length - p(10))
If name = name1 And child = child1 And dnf = dnf1 And baloon = baloon1 And created < created1 Then
sw.WriteLine(name1 & child1 & desF1 & desAF1 & desA1 & desAA1 & ecn1 & dnf1 & baloon1 & dateTime1 & Space(22 - dateTime1.Length) & qty1)
Else
sw.WriteLine(name & child & desF & desAF & desA & desAA & ecn & dnf & baloon & dateTime & Space(22 - dateTime.Length) & qty)
End If
name = name1
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Language - vb.net 2008
I drag dropped a control(Infragistics ultrawingrid) and the contral is coming in
status bar sort of thing. Like the timer control comes.
Now the problem is, the control is not coming in the designer.
oi hav ethe license to use the infragistics control.
Can you give me any idea?
|
|
|
|
|
Better place is Infragistics support.
|
|
|
|
|
That means it's a System.ComponentModel.Component not a System.Windows.Forms.Control .
The former is used when no UI is needed for the component.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi ...
modified 28-Nov-12 8:11am.
|
|
|
|
|
I have found the solution to solve this issue
|
|
|
|
|
Hi guys, i'm a newbie programmer currently trying to develop a CRM software.
I am using VS 2005 (VB.Net) with MS SQL as the database.
As the title says, i am looking to display data (from my database) in a bar graph/pie chart like in http://img24.imageshack.us/img24/4885/piey.jpg[^].
Are there any tutorials available for what i am looking to do? I'm not sure how i should be doing this, with a windows form :A control to display pie charts with highly customizable formatting[^]? Or with what is done here: Drawing a Bar Chart[^]
Would appreciate any help/suggestions, as i'm at a loss to what to do, heh.
Thanks, and apologies if i'm posting in the wrong forum.
Edit: I came across A WPF Pie Chart with Data Binding Support[^] - looks really nice, but apparently it was " created by a newer version of this application(Visual Studio) and cannot be opened".
modified on Monday, May 11, 2009 12:06 AM
|
|
|
|
|
Microsoft has a nice free chart control - MSChart - (Similar to DundasChart)not sure it will work with VS2005 - Depends on what framework version maybe.
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Hi,
normaly it is easier to use a control, if that looks the way you want/need. If you dont get the look you have to paint it 'by hand'. Try to search on codeproject or google, there are tons of good free charting controls out there.
The whole WPF stack is based on DotNET 3.5 and does not run under the 2.0 framework that VS 2005 is targeted at.
Regards: Didi
|
|
|
|
|
Thanks guys, i'll try it out and get back to you!
|
|
|
|