|
Make an abstract property get-set called Left which the derived classes override.
:josh:
My WPF Blog[^]
|
|
|
|
|
further to Josh's suggestion, the point of an abstract class is to abstract the functionality (as the name implies). Something like this would satisfy
public abstract class AbstractThing : myInterface
{
protected abstract void SetVisible();
protected abstract void SetInvisible();
public void Visible(bool view)
{
if(view)
SetVisible();
else
SetInvisible();
}
}
then your derived class, which has the Left property defined.
public DerivedThing : AbstractThing
{
protected override void SetInvisible(){ this.Left = -50000; }
protected override void SetVisible(){ this.Left = 0; }
}
or say you derive it and you wantr different behaviour for SetVisible and SetInvisible..eg/
public OtherDerivedThing : AbstractThing
{
protected override void SetInvisible(){ this.Visible= false; }
protected override void SetVisible(){ this.Visible = true; }
}
---
How to get answers to your questions[^]
-- modified at 10:36 Friday 14th July, 2006
|
|
|
|
|
Hi,
I have the following problem when trying to use Custom Controls published here at CodeProject with the full source code:
1.) I add the control source to my project
2.) Project compiles, everythings fine.
When I now want to add the control using the designer, I have to import it from the binary assembly the project has created ( so I'm referencing myself). Is there another way of registering in the toolbox just using the sourcecode ?
Its a bit annoying, because I get a warning that I'm using a different type. The most ExampleProjects have all integrated, but don't reference the outputbinary for having designer support.
I don't want to create a separate assembly containing all controls at the moment and I didn't found another solution yet.
Many thanks,
Florian
|
|
|
|
|
I think VS 2005 hadnles this issue better than VS 03. For VS2003 and if the control is inheriting from UserControl than double clicking it (so that the designer view pops up) then it should automatically being added to the toolbox.
|
|
|
|
|
Hi Robert,
if I click on the control sourcecode item ( e.g. Control.cs) i get a screen with the follwing text (window tab says "Control.cs [Design]":
To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create events for your class, click here to switch to code view.
Well, that pretty obvious, but I have no idea how to convince the toolbox when editing a form to display the control which is only existing in sourcecode at that moment. Ok, it seems that the Control I use is not inherited from UserControl, so it may not work here.
But you mean, if doubleclicking the sourcefile in the project should be enough if it is inherited from UserControl ?
Thanks,
Florian
|
|
|
|
|
Keep the control code seperate from your own. Make the control it's own seperate Project, then you can have it show up in the ToolBox.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Silly Question~
Which Component Reference do I need to use the StreamWriter Class?
Thanks in advance.
|
|
|
|
|
No reference needed.
Juz include
System.IO Namespace
|
|
|
|
|
Hi, all.
I'm trying to create an RFID application and related hardware using C# but couln't find any resource. Could anyone please tell me where I can learn about these stuffs. I've been searching for quite awhile but couldn't find it. When it comes to firmware programming, they mostly use C++, not C#. Please help.
KiT
|
|
|
|
|
Hi KiT,
do you want to program a firmware using C# or do you just want to acess functions using an existing SDK for your hardware ?
Firmware Programming using C# doesn't works at the moment I suppose, because you would need a CLR (common language runtime) for your desired microcontroller. But the most microcontrollers have a C/C++ compiler generating native code, which can be executed by them, so I suppose you have at the least to use C/C++, which is very common in the embedded world (despite a few native java processors).
Bye,
Florian
|
|
|
|
|
I see. Thank you very much, Florian. I've understood correctly that I intended to use only C# for embeded programming. But, aww... okay, I'll try C++ (I hate pointers -_-"). Thank you again for your help.
KiT
|
|
|
|
|
Just be glad that you've got C and don't have to write in asm. Specialty embedded hardware is one of the asm programmers last bastians.
|
|
|
|
|
Hi KiT,
well, if you want to do embedded programming you shouldn't rely too much on the garbage collection, as you've usually very limited resources. So it's a great benefit knowing what is going on in the system and having everthying under control. Otherwise you may be in trouble with running out of resources. So it's very helpful to do some things the hard way, it's usually easier then being effective on managed languages as well.
Bye,
Florian
|
|
|
|
|
hello all. i have a probelm in getting user input during installation wizard.
after getting the values iam trying to store it in a configuration file. using an exe. where the exe contains installer class. i register AfterInstall event in installer class
<br />
void Installer1_AfterInstall(object sender, InstallEventArgs e)<br />
{<br />
XmlDocument configXml = XmlDocument ()<br />
configXml.Load(Application.StartupPath+"\\ConfigurationXML.xml")<br />
XmlNode xmlNd = configXml.SelectSingleNode("//Periperals/MES/Ethernet/IPAddress");<br />
xmlNd.InnerText = Context.Parameters["IP"].ToString();<br />
xmlNd = configXml.SelectSingleNode("//Periperals/MES/Ethernet/Port");<br />
xmlNd.InnerText = Context.Parameters["PORT"].ToString();<br />
xmlNd = configXml.SelectSingleNode("//Periperals/MES/Ethernet/VirtualDirectory");<br />
xmlNd.InnerText = Context.Parameters["WEB"].ToString();<br />
configXml.Save();<br />
}<br />
here IP,WEB,PORT are the inputs that iam getting using the wizard during installation
ConfigurationXML is the xml file where i want to write the user inputs.
but during istallation i getting the following error.
"Exception occured in OnAfterInstall event handler ConfigurationXML.xml not found on the location C:\WINDOWS\system32\ConfigurationXML.xml"
Why it so? i have specified as Application.Startup path right!
|
|
|
|
|
Obviously, the installer's Application.StartupPath must be "C:\WINDOWS\system32", in which case you want something like the Installation Path - which I do not know offhand how you would get from the installer. Someone im sure will answer with that knowledge, but you could search the docs if you're in a hurry.
---
How to get answers to your questions[^]
|
|
|
|
|
How CTI/IVR (Computer telephony integration/interactive voice response) applications can be developed in C# .net 2003. Is C# .net supports Dll like Visual C++ 6.0?
|
|
|
|
|
I think your first step is to some classes or read some books on .NET and C# before asking such a question.
Yes, .NET uses dll's, they are called assemblies.
|
|
|
|
|
hi
i am testing whther a device is connected or not to the usb.i want the status to be displayed dynamically in a label.if i use Thread.sleep() only the final status is getting displayed.intermediate statusus r not visible.
could u plz help me out.
thank u
sincerly
cynthia
|
|
|
|
|
Try to put your method in a separate Thread.
|
|
|
|
|
You could check the connection status in a timer tick (quick and dirty) or a separate thread (recommended).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I think UI thread doesn't get time to redraw.
On every updation of status put the following code
<br />
yourLabel.Text="status";<br />
mainForm.Refresh();
this refresh method will repaint the GUI
|
|
|
|
|
hi all,in my web application i use form authentication mode it works fine in my local system, but in server it wont work and wont allow me to log in (when i click on the link it load the login page again)what willbe the problem .here is my webconfig file ....
authentication mode="Forms">
<forms name=".auth" loginurl="login.aspx" path="/">
/authentication>
authorization>
deny users="?" />
/authorization>
help me to solve this prob........
Regards,
ayyp
-- modified at 7:34 Friday 14th July, 2006
|
|
|
|
|
I also had the same problem , i use forms authentication to access some pages , it is working fine in my local system, but it is returning to the login page again and again when it is hosted in a hosting server.
VB.net code
----------------
FormsAuthentication.Initialize()
FormsAuthentication.HashPasswordForStoringInConfigFile(TxtPwd.Text, "sha1")
Dim ticket As New FormsAuthenticationTicket(1, TxtLoginID.Text, DateTime.Now, DateTime.Now.AddMinutes(180), False, userrole)
Dim hash As String = FormsAuthentication.Encrypt(ticket)
Dim cookie As New HttpCookie(FormsAuthentication.FormsCookieName, hash)
Response.Cookies.Add(cookie)
FormsAuthentication.RedirectFromLoginPage(TxtLoginID.Text, True)
Global.asax code
-------------------
Imports System.Web.SessionState
Imports System.Web.Security
Imports System.Security.Principal
Namespace FormsAuthDB
''' <summary>
''' Summary description for Global.
''' </summary>
Public Class [Global]
Inherits System.Web.HttpApplication
Public Sub New()
InitializeComponent()
End Sub
Protected Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
If HttpContext.Current.User IsNot Nothing Then
If HttpContext.Current.User.Identity.IsAuthenticated Then
If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then
' Get Forms Identity From Current User
Dim id As FormsIdentity = DirectCast(HttpContext.Current.User.Identity, FormsIdentity)
' Get Forms Ticket From Identity object
Dim ticket As FormsAuthenticationTicket = id.Ticket
' Retrieve stored user-data (our roles from db)
Dim userData As String = ticket.UserData
Dim roles As String() = userData.Split(","c)
' Create a new Generic Principal Instance and assign to Current User
HttpContext.Current.User = New GenericPrincipal(id, roles)
End If
End If
End If
End Sub
Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
#Region "Web Form Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
End Sub
#End Region
End Class
End Namespace
Code in web.config inside the login pages folder
--------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow roles="admin" />
<allow roles="OtherAdmin" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
Please help me this is very important for me.
Thanks in advance....
|
|
|
|
|
hai all,
is there any particular function by which i can directly use unicode in API..
for eg:
TextOutA(hDevice, sXPos, sYPos, StaticObjects.gtSizeName[lIndex], StaticObjects.gtSizeName[lIndex].Length);
here can i use language "HINDI" for [lIndex]...i tried but it is giving "???" in the places where "HINDI" language is used while running.
|
|
|
|
|
Use TextOutW
regards
modified 12-Sep-18 21:01pm.
|
|
|
|