|
An abstract class is a class that is meant to be derived from by other classes. It is used to provide a single interface that can be implemented differently. While interfaces also provide the functionality, abstract classes allow implementation, so you can have the abstract base class provide a sort of template, with the missing parts filled in by the deriving classes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hey,
Anybody know how to recodr voice from the mic ...???
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
|
Hello,
I have a 1 table with a list of departments, and another table with a list of employees who work in those departments.
What I want to do is select a department from a combo box, and display all the employees who work in that department in a list box.
I am using a dataset and created the data relationship between the 2 tables. My code is as follows:
OleDbCommand cmd = cnn.CreateCommand();<br />
cmd.CommandType = CommandType.Text;<br />
cmd.CommandText = "SELECT * FROM Employee";<br />
da.SelectCommand = cmd;<br />
da.FillSchema(ds,SchemaType.Source,"Employee");<br />
da.Fill(ds,"Employee");<br />
<br />
cmd.CommandText = "SELECT * FROM Department";<br />
da.SelectCommand = cmd;<br />
da.FillSchema(ds,SchemaType.Source,"Department");<br />
da.Fill(ds,"Department");<br />
<br />
DataColumn parentColumn = ds.Tables["Department"].Columns["DepartmentCode"];<br />
DataColumn childColumn = ds.Tables["Employee"].Columns["DepartmentID"];<br />
<br />
ds.Relations.Clear();<br />
DataRelation drEmployees = new DataRelation("EmployeeDetails",parentColumn,childColumn);<br />
ds.Relations.Add(drEmployees);<br />
<br />
foreach employee in departments<br />
Add to the list box<br />
Many thanks in advance,
Steve
|
|
|
|
|
Hi,
Sorry if this is obvious, but...
I'm writing a C# Forms app in VS.NET 2003. I have enabled the XP theme in the form by importing the requisite functions from uxtheme.dll and calling EnableVisualStyles().
To get the style to show on the tab pages, I implemented a paint handler for the tab pages where I call DrawThemeBackground(). (all of this I have gotten from articles here)
All of this works fine, and the tab pages themselves look great, but the problem is that labels and checkboxes on the tab pages, which I have set to use a transparent background and FlatStyle=FlatStyle.System, paint a white background.
I tried creating custom controls, where I inherit from Checkbox and Label, and override OnPaint and do something similar to what I did for the tab page, but it still doesn't work.
Any ideas as to what I'm doing wrong, or missing?
Thanks,
Joe
|
|
|
|
|
have you tired this:
Application.DoEvents();
Steve
|
|
|
|
|
Yes. I had a call to DoEvents() right after calling EnableVisualStyles().
I sprinkled DoEvents() calls liberally throughout the tab page's Paint event handler, as well as in the OnPaint in my custom checkbox control, to see if there is some point in the painting that needed it, but there was no change.
Joe
|
|
|
|
|
You have to put this line immediately after your call to EnableVisualStyles:
Application.DoEvents();
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, immediately after the call to EnableVisualStyles() I have a call to DoEvents(). And still the label and checkbox controls paint a white background.
Tomorrow I'll post some code snippits.
Joe
|
|
|
|
|
My main function looks like:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
...
}
And my handler for the Paint event for my tab page is:
private void VisualStyleTabPage_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Control c = (Control)sender;
IntPtr hTheme = OpenThemeData(c.Handle, "Tab");
try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(c.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}
When I set, for instance, the label control's BackColor to Transparent, it paints a solid white background for the control. So, I created a custom control that inherits from Label, and overrode the OnPaintBackground handler, painting with the same color as the tab page's background:
protected override void OnPaintBackground(PaintEventArgs e)
{
Graphics g = e.Graphics;
IntPtr hTheme = OpenThemeData(this.Handle, "Tab");
try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(this.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}
This paints most of the background of the label control with the correct background, but the horizontal strip where text is present is still solid white.
Thanks,
Joe
|
|
|
|
|
Dear All,
i want to connect and call the Function Modules of SAP i.e. DLLs into C#.Net.
Could anyone tell me plz how to do that?
Thanks & Regards,
Muskaan.
|
|
|
|
|
Using the .NET Connector from MS page.
|
|
|
|
|
Thanks,
But cud you pls tell me HOW can i call the modules of SAP into C#.NET project.
SAP DOT NET Connector is gonna act as an INTERFACE between SAP and DOT NET, right???
so how to actually call the module of SAP into C#?
Pls help.
Thanks & Regards,
Muskaan.
|
|
|
|
|
I want to format a floating point number with accuracy 2 digits after the point, but if the number is round, to show it more friendly. For example:
if the number is 2.3, show 2.3 and not 2.30
if it's 3, show 3 and not 3.00
and if the number is 4.12345, show 4.12
What' the formatting string that I can achieve this with?
Thanks in advance
|
|
|
|
|
float number = 4.12345;
string result = String.Format("{0:00}", Math.Round(number,2));
|
|
|
|
|
Ahha! Works, but with formatting string "{0}" is better.
Thanks a lot, seems that the Round trick is the keystone here
|
|
|
|
|
I have the OnButtonClick Event inside a Form
btnGetInfo_Click(object sender, System.EventArgs e)
Here is the implementation
System.Reflection.MethodInfo mi = this.oSender.GetType().GetMethod("btnGetInfo_Click", ???);<br />
mi.Invoke(oSender, System.Reflection.BindingFlags.InvokeMethod, null, null???, null);
But how I can implement the parameters - object sender and System.EventArgs e ?
|
|
|
|
|
<br />
System.Reflection.MethodInfo mi = this.oSender.GetType().GetMethod("btnGetInfo_Click", ???);<br />
the overload list for GetMethod provides several possible parameterlists.
if there is only one method btnGetInfo_Click inside your form, you can call GetMethod only with your methodname. otherwise you have to pass the types of your parameters:
<br />
System.Reflection.MethodInfo mi = this.oSender.GetType().GetMethod("btnGetInfo_Click");<br />
or
<br />
System.Reflection.MethodInfo mi = this.oSender.GetType().GetMethod("btnGetInfo_Click", new Type[]{typeof(object),typeof(EventArgs)});<br />
<br />
mi.Invoke(oSender, System.Reflection.BindingFlags.InvokeMethod, null, null???, null);<br />
the forth parameter needs an array of parameters for "sender" and "e".
<br />
mi.Invoke(oSender, System.Reflection.BindingFlags.InvokeMethod, null, new object[]{null,null}, null);<br />
|
|
|
|
|
|
Hi I hope someone can help
I am creating a C# project that stores data into an Access database.
I have created a dataset using an OleDbDataAdapter with a sql select statment
"SELECT table.* FROM table
This table has a long Interger autonumbering ID key field, 1 text field, 1
Long Interger field, and 31 Double fields.
I then use the Commandbuilder object to create the Insert, delete and update
commands.
The Insert command seems to work ok as I can create a new row and use the
OleDbDataAdapter.update( ); with now problems
My problem is that I get Syntax error (missing operator) when I attempt to
update a record set after deleting a row.
After this I introduced a dataGrid control and connected this to the dataset
and all the data seems to be ok.
I have other tables in my project that a treated in a similar mannor and
these seem to delete rows ok. The only thing is that these other tables have
less fields but thats the only differance that I can see.
Any ideas?
--
All the best
Hawkmoth
All the best
Hawkmoth
|
|
|
|
|
Hawkmoth wrote:
My problem is that I get Syntax error (missing operator) when I attempt to
update a record set after deleting a row.
What does your SQL statement look like when you run the update statement? Have you tried to run the update statement within Query Analyzer?
|
|
|
|
|
Hi Nick
Thanks for your help.
The select statment below is from the adaptor right before the updating.
The Delete command is generated from the CommandBuilder.
I will take a look at the analyser. (Not something I've ever used before!!).
SELECT Spex.* FROM Spex
DELETE FROM Spex WHERE ( (spex_id = ?) AND ((? = 1 AND Std_Name IS NULL) OR (Std_Name = ?)) AND ((? = 1 AND ID IS NULL) OR (ID = ?)) AND ((? = 1 AND 400nm IS NULL) OR (400nm = ?)) AND ((? = 1 AND 410nm IS NULL) OR (410nm = ?)) AND ((? = 1 AND 420nm IS NULL) OR (420nm = ?)) AND ((? = 1 AND 430nm IS NULL) OR (430nm = ?)) AND ((? = 1 AND 440nm IS NULL) OR (440nm = ?)) AND ((? = 1 AND 450nm IS NULL) OR (450nm = ?)) AND ((? = 1 AND 460nm IS NULL) OR (460nm = ?)) AND ((? = 1 AND 470nm IS NULL) OR (470nm = ?)) AND ((? = 1 AND 480nm IS NULL) OR (480nm = ?)) AND ((? = 1 AND 490nm IS NULL) OR (490nm = ?)) AND ((? = 1 AND 500nm IS NULL) OR (500nm = ?)) AND ((? = 1 AND 510nm IS NULL) OR (510nm = ?)) AND ((? = 1 AND 520nm IS NULL) OR (520nm = ?)) AND ((? = 1 AND 530nm IS NULL) OR (530nm = ?)) AND ((? = 1 AND 540nm IS NULL) OR (540nm = ?)) AND ((? = 1 AND 550nm IS NULL) OR (550nm = ?)) AND ((? = 1 AND 560nm IS NULL) OR (560nm = ?)) AND ((? = 1 AND 570nm IS NULL) OR (570nm = ?)) AND ((? = 1 AND 580nm IS NULL) OR (580nm = ?)) AND ((? = 1 AND 590nm IS NULL) OR (590nm = ?)) AND ((? = 1 AND 600nm IS NULL) OR (600nm = ?)) AND ((? = 1 AND 610nm IS NULL) OR (610nm = ?)) AND ((? = 1 AND 620nm IS NULL) OR (620nm = ?)) AND ((? = 1 AND 630nm IS NULL) OR (630nm = ?)) AND ((? = 1 AND 640nm IS NULL) OR (640nm = ?)) AND ((? = 1 AND 650nm IS NULL) OR (650nm = ?)) AND ((? = 1 AND 660nm IS NULL) OR (660nm = ?)) AND ((? = 1 AND 670nm IS NULL) OR (670nm = ?)) AND ((? = 1 AND 680nm IS NULL) OR (680nm = ?)) AND ((? = 1 AND 690nm IS NULL) OR (690nm = ?)) AND ((? = 1 AND 700nm IS NULL) OR (700nm = ?)) )
All the best
Hawkmoth
|
|
|
|
|
I've been looking all over for a code sample of a nonvisual control, and searched through MSDN with no luck so far. Does anyone have some sample code or a link to a good article on how to implement a nonvisual control(I think they previously were called invisible-at-runtime.) For those who don't know what I'm talking about, I need the same design time behavoir as the OpenFileDialog where when you drag it onto a form, it gets placed below the form in the designer, and is never seen by the user. Thanks in advance for the help.
|
|
|
|
|
You can simply derive your class from Component. That way you get designer support but don't have a control shown at runtime.
Regards,
mav
|
|
|
|
|
How can i Create a Custom Browser with Internet Browsing facility.it must also have the options for Blocking some websites.
for the above requirement which type of application(a windows application or an ASP.net application)must i use.
i want to do the whole thing in C#.net
|
|
|
|
|