|
You should be able to cast the sender parameter to Button type: Button button = (Button)sender;
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
that did the trick.
thank you!
|
|
|
|
|
could you direct me to any sites that explain how to use custom buttons on titlebar Close/Minimise etc
|
|
|
|
|
please read the top thread in here ("How to get your answers...")
posting the message twich is not very much smart like this.
the least you can do is search the codeproject for articles like this, but this is so small... just make a button, and register to the click event, and on the method you can do either
this.Minimise();<br />
this.Close();<br />
Application.Exit();
etc...
|
|
|
|
|
The title bar is a non-client area. You can't "just make a button" and drag it there as you would in the middle of a form. If it were that easy, the question likely would not have been posed.
Also, your making snide comments about how smart others' questions are is not recommended--at least not while this forum's contents can be searched through by name.
--
I've killed again, haven't I?
|
|
|
|
|
|
|
Why did you start a new thread when you already had one about this?
---
b { font-weight: normal; }
|
|
|
|
|
I have a component with COM Interop so its methods can be called from both .NET and COM applications.
I need to do the Windows Service that should do the same and which methods can be called from both .NET and COM. How could I convert this component to service?
Sorry for noob question, I am new with conceptions of Components and especially Services.
Thanks.
|
|
|
|
|
I am confused as to what your question is.
A Service is a process (.exe). You can use the component in the Service if that is what you mean.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
I've got a multi-tiered enterprise app, that I'm having trouble extending.
I want to build events into my DAL, but can't figure out how to do so without creating a circular reference.
I've got Architecture, DataAbstraction, and Data layers all in seperate DLLs. The architecture layer is simply a factory.
Wherever my events are handled I will need access to the DAL for data. Wherever the events live will need to trigger the handlers.
I can't think of a way to get this done without creating a circle in my references!
|
|
|
|
|
You can use an interface to declare the functionality required of your concrete object, code to the interface, and assign an concrete object to the interface member at runtime.
--
I've killed again, haven't I?
|
|
|
|
|
That's the route I've been down in trying to get this working, but I can't figure out how to lay it out. I still get a circle in every attempt I've made.
If "A" has events, and an interface that implements handlers in "B" and "B" needs to reference "A" to do it's job, how do I wire up the interface in "A"? I still need to reference A's dll from B, and vice versa, right?
|
|
|
|
|
When I ran into the circular reference issue, I found this page[^], which provided the info I needed. Part of the trick may be in determining which solves your particular situation better:
- A implements IA, and B has an IA member that gets assigned an A, or
- if B implements IB and A has an IB member that gets assigned a B
--
I've killed again, haven't I?
|
|
|
|
|
Im getting "The Server is not operational" when authenticating user to active directory
Any help plzz...
Thanks in advance
Krishna
|
|
|
|
|
Hello
I am new to the DLLImport, and I just cant figure out how it works.
I have seen in many other applications they use the DLLImport,
an example is:
[DllImport("KERNEL32.DLL", EntryPoint="MoveFileW", SetLastError=true,
CharSet=CharSet.Unicode, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern bool MoveFile(String src, String dst);
(found it in the MSDN libary)
Then my questen is how you know what to
write after the [DLLImport ("KERNEL32.DLL",
Is there a place to look it up? or are people just guessing what to write? :
Just to let you know, it is not the KERNEL32.DLL specific i want to know about, just about the dll's in general.
So if anyone know a place where to find this kind of information I would be happy.
Thanks
QzRz
|
|
|
|
|
|
You can go to pinvoke.net but why are you trying to call an unmanaged function (MoveFile) when you can just use File.Move() ?
|
|
|
|
|
It was just as an example, as it was the only thing I could find, but the pinvoke.net was exactly what I was looking after.
Thanks.
|
|
|
|
|
Is it possible to use custom buttons for close minimise
|
|
|
|
|
|
I'm trying to use some unmanaged code in my app. Right now i'm getting errors that indicate the struct i'm using is not correct. Below is the unmanaged struct i'm trying to use and following that is my C# implementation of it. Can anyone spot what i'm doing wrong in my struct and suggest how to fix it? Thanks.
Unmanaged version:
typedef struct _FAX_COVERPAGE_INFO {
DWORD SizeOfStruct;
LPCTSTR CoverPageName;
BOOL UseServerCoverPage;
LPCTSTR RecName;
LPCTSTR RecFaxNumber;
LPCTSTR RecCompany;
LPCTSTR RecStreetAddress;
LPCTSTR RecCity;
LPCTSTR RecState;
LPCTSTR RecZip;
LPCTSTR RecCountry;
LPCTSTR RecTitle;
LPCTSTR RecDepartment;
LPCTSTR RecOfficeLocation;
LPCTSTR RecHomePhone;
LPCTSTR RecOfficePhone;
LPCTSTR SdrName;
LPCTSTR SdrFaxNumber;
LPCTSTR SdrCompany;
LPCTSTR SdrAddress;
LPCTSTR SdrTitle;
LPCTSTR SdrDepartment;
LPCTSTR SdrOfficeLocation;
LPCTSTR SdrHomePhone;
LPCTSTR SdrOfficePhone;
LPCTSTR Note;
LPCTSTR Subject;
SYSTEMTIME TimeSent;
DWORD PageCount;
} FAX_COVERPAGE_INFO, *PFAX_COVERPAGE_INFO;
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME,
*PSYSTEMTIME;
C# version:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class FAX_COVERPAGE_INFO
{
public int SizeOfStruct = 0;
public String CoverPageName=null;
public bool UseServerCoverPage=true;
public String RecName = null;
public String RecFaxNumber = null;
public String RecCompany = null;
public String RecStreetAddress = null;
public String RecCity = null;
public String RecState = null;
public String RecZip = null;
public String RecCountry = null;
public String RecTitle = null;
public String RecDepartment = null;
public String RecOfficeLocation = null;
public String RecHomePhone = null;
public String RecOfficePhone = null;
public String SdrName = null;
public String SdrFaxNumber = null;
public String SdrCompany = null;
public String SdrAddress = null;
public String SdrTitle = null;
public String SdrDepartment = null;
public String SdrOfficeLocation = null;
public String SdrHomePhone = null;
public String SdrOfficePhone = null;
public String Note = null;
public String Subject = null;
public SystemTime TimeSent;
public int PageCount = 0;
}
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
|
|
|
|
|
BOOL is same size as int I think.
|
|
|
|
|
Hi.
Does anybody knows how to create a windows account with c# or some api's calls in c++? ( specifically a "restricted" one)
Or a installer that creates windows accounts...
Thanks
Alejandro
|
|
|
|
|
I have an rtf file that I can creating
in some of the sections I am placing contentholders [contenthere] throughout the document.
I need to be able to open up that file and search and replace that [contentholder] with the read data.
The code I used to do this is:
<br />
FileStream swfile = new FileStream(Server.MapPath("") + fPath + filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);<br />
<br />
StreamReader sr = new StreamReader(swfile);<br />
StreamWriter sw = new StreamWriter(swfile);<br />
However, I am able to loop through the document but the original is still there when done.
here is the code I use to actually search and replace:
<br />
while(sr.Peek() >=0)<br />
{<br />
myContent = sr.ReadLine(); <br />
<br />
<br />
if(VB.InStr(myContent, "[PROSPECT]", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent += myContent.Replace("[PROSPECT]", objGCache.GetProspectName());<br />
sw.Write(myContent);<br />
}<br />
else<br />
{<br />
if(VB.InStr(myContent, "{PROSPECT}", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent += myContent.Replace("{PROSPECT}", objGCache.GetProspectName());<br />
sw.Write(myContent);<br />
}<br />
else<br />
{<br />
if(VB.InStr(myContent, "(PROSPECT}", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent += myContent.Replace("(PROSPECT)", objGCache.GetProspectName());<br />
sw.Write(myContent);<br />
}<br />
}<br />
}<br />
<br />
if(VB.InStr(myContent, "{CONTACT NAME}", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent += myContent.Replace("{CONTACT NAME}", objGCache.GetContactName());<br />
sw.Write(myContent);<br />
}<br />
<br />
if(VB.InStr(myContent, "{ADDRESS}", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{ <br />
myContent += myContent.Replace("{ADDRESS}", objGCache.GetAddress1());<br />
sw.Write(myContent);<br />
}<br />
<br />
if(VB.InStr(myContent, "{CITY, STATE ZIP}", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent += myContent.Replace("{CITY, STATE ZIP}", objGCache.GetCity() + "," + objGCache.GetState() + " " + objGCache.GetZip()); <br />
sw.Write(myContent);<br />
}<br />
<br />
if(VB.InStr(myContent, "[WWH]", Microsoft.VisualBasic.CompareMethod.Text) > 0)<br />
{<br />
myContent = myContent.Replace("[WWH]",newcontent);<br />
sw.Write(myContent);<br />
}<br />
<br />
<br />
<br />
<br />
<br />
}<br />
Sorry for the length and bad formatting, dont have time to look all pretty
If anyone could give some advice asap, that would be greatly appreciated.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|