|
I have downloaded source code from: http://www.divil.co.uk/net/articles/designers/hosting.asp and its very complex. It allows one to create, manipulate, move etc controls in run time.
The only problem is, I need to be able to programmatically place a PANEL on top of all the controls and other stuff and still use the control box to drag controls on top of this panel. At the moment I can achieve this but the controls dissapear behind the panel!
Please download the code and try it out for yourself!
|
|
|
|
|
How do I clear all of the event handlers on for example a toolbar button click.
Toolbar1.ButtonClick = null; doesn't work it generates Compiler Error CS0079. is there a way to clear all of the handlers without using an explicit reference to all of them.
M
-- modified at 6:10 Tuesday 7th February, 2006
On this post I typed <:code> Toolbar1.Button[nospace]Click = null;<:/code> but it comes out as out as Toolbar1.Buttonclick. There appears to be a bug in formatting.
-- modified at 6:13 Tuesday 7th February, 2006
|
|
|
|
|
Where are you assigning the null value?
Make sure it is after you wire the event handlers, otherwise its pretty pointless lol.
Why not just comment out the wiring code?
Hope this helps
James
|
|
|
|
|
James Gupta wrote: Why not just comment out the wiring code?
Er.. that doesn't really make much sense.
I'm assigning event handlers in my code and then later on I don't want those event handlers to handle the event anymore I want something else to handle it. .ButtonClick only allows += and -= it doesn't allow you to reset the handlers without explicitly referencing them with -=.
|
|
|
|
|
mintguy wrote: .Buttonclick only allows += and -= it doesn't allow you to reset the handlers without explicitly referencing them with -=.
Without the reference, how is it oging to know which one to drop?? No, you can't just drop them all without any regard to what they are.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ah right now I know what you mean - it was not really explained in your first post
|
|
|
|
|
Hi all
Im reading data from an excel file into a c# string, but when i come across a date it is being read in as it's serial date (the number of days thing)
i want the string to hold the exact string literal of the date (e.g. 7/2/2006) and not the serial date, so how do i check the cell value to see if it is a date?
i cant just convert every number that comes out to a date as i still want numbers to be numbers, i just want dates to be converted.
i cant find anything in the excel model that will give me the cell data type
does anyone know how to do this?
|
|
|
|
|
Excel doesn't actually know that the cell contains date information. Instead, with AutoFormat, it sets the NumberFormat property of the cell to the default date format which, for my installation, equals "m/d/yyyy".
I had this same problem with a C# Automation Add-In that I wrote for Excel. I essentially had to write some code to distinguish a number from a date using a combination of the cell value and the NumberFormat property.
I hope that helps.
|
|
|
|
|
thanks for the info, ive managed to do it in one of the longest winded ways ive ever had to do something in my life of programming!
<br />
private string excelSerialDateToDMY(int serialDate)<br />
{<br />
int nDay;<br />
int nMonth;<br />
int nYear;<br />
if (serialDate == 60)<br />
{<br />
nDay = 29;<br />
nMonth = 2;<br />
nYear = 1900;<br />
<br />
return "29/02/1900";<br />
}<br />
else if (serialDate < 60)<br />
{<br />
serialDate++;<br />
}<br />
<br />
int l = serialDate + 68569 + 2415019;<br />
int n = ( 4 * l ) / 146097;<br />
l = l - ( 146097 * n + 3 ) / 4;<br />
int i = ( 4000 * ( l + 1 ) ) / 1461001;<br />
l = l - ( 1461 * i ) / 4 + 31;<br />
int j = ( 80 * l ) / 2447;<br />
nDay = l - ( 2447 * j ) / 80;<br />
l = j / 11;<br />
nMonth = j + 2 - ( 12 * l );<br />
nYear = 100 * ( n - 49 ) + i + l; <br />
return nDay+"/"+nMonth+"/"+nYear;<br />
}<br />
<br />
public bool inArray(object key, object[] array)<br />
{<br />
for (int c=0; c<array.Length; c++)<br />
{<br />
if (array[c].Equals(key))<br />
return true;<br />
}<br />
return false;<br />
}<br />
<br />
string[] dateArray={"dd/mm/yyyy","[$-F800]dddd, mmmm dd, yyyy","dd/mm/yyyy;@","dd/mm/yy;@","d/m/yy;@","d.m.yy;@","yyyy-mm-dd;@","[$-809]dd mmmm yyyy;@","[$-809]d mmmm yyyy;@"};<br />
<br />
<br />
if (inArray(myType.ToString(),dateArray))<br />
{<br />
string retDate=excelSerialDateToDMY(Int32.Parse(myVal.ToString()));<br />
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-GB");<br />
DateTime myDate = DateTime.Parse(retDate,culture,System.Globalization.DateTimeStyles.NoCurrentDateDefault); <br />
return myDate.ToShortDateString();<br />
}<br />
else <br />
return myVal.ToString();<br />
i hope this helps someone else in the future
|
|
|
|
|
hi all,
To strip off circular dependency between a C# proj and a C++ proj, I need to define an interface in C++ proj. and implement it with C#. The code is like this:
//in C++ proj.
using namespace A
__gc __interface IA
{
void display();
}
//in C# proj.
public class B : A.IA
{
void display(){}
}
the error message is like this: COM Interop registration failed. Could not find a type library for assembly "A.IA" ...
3q for help!
Dilly
|
|
|
|
|
Please Check that mangaed c++ u referenced r nt
|
|
|
|
|
Hi,
I've searched a lot on internet and in msdn library, but I don't exactly know what really works.
I can use call C++ method in my C# project, but I can not implement the C++ interface, I know little about COM/COM+, can you tell me more? 3q!!!
Dilly
|
|
|
|
|
Let strReturndata be a string variable
strReturndata =
"Index 2 Settings:
---------------------
Oxy =XX
BPM=YY
Note: Modifying the following 4 variables inhibit oxy display until the next [oxy NN] command
RAC=610
IRAC=1000
RDC=1024
IRAC=1024
Light Flash: Unit Under Test
AC=100%
AMB=0%
Make=Nellcor"
The XX and YY values are dynamically generated. What is the syntax to fetch XX and YY value from the string strReturndata using C#
Pushpa Sengathiron
|
|
|
|
|
<FONT color=Blue>string</FONT> strReturndata = <FONT color=Blue>string</FONT><FONT color=DarkBlue>.</FONT>Format<FONT color=DarkBlue>(</FONT>
<FONT color=Maroon>@"Index 2 Settings:</FONT>
<FONT color=Maroon>---------------------</FONT>
<FONT color=Maroon>Oxy = {0)</FONT>
<FONT color=Maroon>BPM= {1}</FONT>
<FONT color=Maroon>Note: Modifying the following 4 variables inhibit oxy display until the next [oxy NN] command</FONT>
<FONT color=Maroon>RAC=610</FONT>
<FONT color=Maroon>IRAC=1000</FONT>
<FONT color=Maroon>RDC=1024</FONT>
<FONT color=Maroon>IRAC=1024</FONT>
<FONT color=Maroon>Light Flash: Unit Under Test</FONT>
<FONT color=Maroon>AC=100%</FONT>
<FONT color=Maroon>AMB=0%</FONT>
<FONT color=Maroon>Make=Nellcor"</FONT>, XX, YY<FONT color=DarkBlue>)</FONT>;
xacc.ide-0.1.2.6 New syntax highlight screenshots of xacc.ide
|
|
|
|
|
Was he asking how to format the string, or how to parse it? I thought latter but you thought former
|
|
|
|
|
|
There are a few ways to do this.
1) Parse it line by line until you come to a line starting 'Oxy=' or 'BPM=' and read from the first char after '=' to the end of the line. Look up String.IndexOf and String.Substring
2) Use regular expressions. 2 patterns (one to look for each combination) need to be defined and then the string parsed through the expession to get the match. Look up System.Text.RegularExpesssions namespace.
|
|
|
|
|
Hi all
How I can download an attachment from e-mail and save it to the hard disk wiht the origan file(word,excel ,image,...,ex).
Thanks
|
|
|
|
|
|
Hello,
If I want to move an object in a panel than I have a lot of strange effects. I use a panel and an button (inside the panel on a form. If I move the button outside of the panel the behaviour of the panel is correct. But if I scroll first outside to the object and the I move the object to the left side. Than the Scollbar isn't anymore there. I have tested already a lot of things but allways I have a strange behaviour.
Has onyone an idea?
I use the following code:
<br />
public partial class Form1 : Form<br />
{<br />
private Point startLoc = new Point(0, 0);<br />
private Point actLoc;<br />
private Point posScreen;<br />
private bool dragging = false;<br />
private Button draggedObject;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
panel1.AutoScroll = true;<br />
panel1.HorizontalScroll.Enabled = true;<br />
panel1.VerticalScroll.Enabled = true;<br />
<br />
button1.MouseMove += new MouseEventHandler(Object_MouseMove);<br />
button1.MouseDown += new MouseEventHandler(Object_MouseDown);<br />
button1.MouseUp += new MouseEventHandler(Object_MouseUp);<br />
}<br />
<br />
private void Object_MouseDown(Object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left &&<br />
sender.GetType() == typeof(Button))<br />
{<br />
Button visObj = (Button)sender;<br />
<br />
posScreen = visObj.PointToScreen(e.Location);<br />
startLoc = visObj.Location;<br />
draggedObject = visObj;<br />
dragging = true;<br />
}<br />
}<br />
<br />
<br />
private void Object_MouseMove(Object sender, MouseEventArgs e)<br />
{<br />
if (dragging == true)<br />
{<br />
Button visObj = (Button)sender;<br />
<br />
int deltaX = MousePosition.X - posScreen.X;<br />
int deltaY = MousePosition.Y - posScreen.Y;<br />
<br />
actLoc.X = startLoc.X + deltaX;<br />
actLoc.Y = startLoc.Y + deltaY;<br />
if (actLoc.X >= 0)<br />
{<br />
int horVal = this.HorizontalScroll.Value;<br />
int left;<br />
int rightObj = actLoc.X + visObj.Width;<br />
if (rightObj >= this.Width)<br />
{<br />
left = actLoc.X;
}<br />
else<br />
{<br />
left = actLoc.X - this.AutoScrollPosition.X;<br />
}<br />
<br />
visObj.Left = left;<br />
}<br />
else<br />
{<br />
visObj.Left = 0;<br />
}<br />
<br />
if (actLoc.Y >= 0)<br />
{<br />
int top = actLoc.Y;
visObj.Top = top;<br />
<br />
}<br />
else<br />
{<br />
visObj.Top = 0;<br />
}<br />
<br />
}<br />
}<br />
<br />
private void Object_MouseUp(Object sender, MouseEventArgs e)<br />
{<br />
dragging = false;<br />
}<br />
}<br />
Regards and thanks for any hint!!!!!
Hansjörg
|
|
|
|
|
I try to set up my installation file, what I need to do is to get values at installation from user, then take those values and write it to my configuration file.
I have tried to add a custom action to my installer but that doesn't work.
when I build the app in debug and the installation files in debug, when I run the installaion it gives me a reference object not set to an instance of an object error.
If I build the app and the installer in release mode, and then run the installer, it completes the installation but makes no changes to the configuration file.
I also created the overloaded installer class where I'm supposed to get the values to write to the configuration file. But don't know if it works or not. Is there any way that you can step through your installation process as you would do with your normal coding?
What exactly is the difference between debug and release.
Anyone who can help or maybe point me into some direction because I have no idea what I am supposed to do or how the installer actualy work.
|
|
|
|
|
Hi!
If you have a custom action in your installer package, you can simply add a call to MessageBox.Show("Attach debugger now"); to the beginning of your custom action's Installer.Install() method.
When you build and run the installation, the message box should pop up and wait for you to click OK.
Then you can attach your VS debugger to the running process and step through your custom action.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanx, helped alot.
Now I have another question, with that custom action, how do i select multple values.
ie. on customDataAction /ServerName=[EDITA1];/DBName=[EDITA2]
where
Arguments EDITA1;EDITA2
how do i add multiple arguments, or do i need to add a new custom action for every argument.
|
|
|
|
|
Just replace the ';' with a blank.
You'll get each argument separately, i.e. 2 arguments: "/ServerName=..." and "/DBName=..."
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanx a million.
I've been struggling with this installer for the last week.
|
|
|
|