|
hello guys
i have implemented a collection which is derived from CollectionBase and create a control which has a Collection property like this:- eek:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
EditorAttribute("typeof(CollectionEditor)","typeof(System.Drawing.Design.UITypeEditor)")]
public MyCollection ButtonList
{
get
{
return (MyCollection)myObject;
}
set
{
this.myObject= value;
}
}
eek:
but the prblem is when i add the property values using Collection Editor it sets the values for the control but when i rebuild the project it reset the control property null. how can i resolve this problem or is there any place where Collection Editor store their values please help me.
thanx:
|
|
|
|
|
I am adding a chacracter to a string depending on the length of the text in a text box. Unfortunately this move the cursor to the beggining of the text in the text box, how do i move the cursor back to the end??
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
TextBox tb = new TextBox();
tb.SelectionStart = tb.Text.Length;
|
|
|
|
|
Works great, thanks
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
I added my entire C# project to source control (CVS in this case) and am now realising that there are probably files in the project tree that shouldn't be checked in, since their generated locally (such as user settings, or build temp files)
Can anyone give me a list of all the files that shouldn't be in source control?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I always put in my cvs repository only the source files. I never put project files and debug files. This way I am able to use another IDE to keep progamming when I dont have visual studio or csharpdevelop.
You can put, source files, image files, resource files, and database file (once you use access ou dbf as database).
That is it, sorry my poor english.
Thiago - Brazil.
|
|
|
|
|
Hi!
I implement IOleCommandTarget in a .net COM server.
Here's my code. I'm trying to implement an object that can be used as a
COM object for a button in IE. I get a System.ExecutionEngineException when hitting the button (.
---------------------------------implement------------------------------------------
// Import IOleCommandTarget interface
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]public char rgwz;
}
[StructLayout(LayoutKind.Sequential)]
public struct OLECMD
{
public uint cmdID;
public uint cmdf;
}
// Interop definition for IOleCommandTarget.
[ComImport,
Guid("b722bccb-4e68-101b-a2bc-00aa00404770"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleCommandTarget
{
void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] OLECMD[] prgCmds, ref OLECMDTEXT CmdText);
void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut);
}
-----------------------------------implement----------------------------------------
-----------------------------------using----------------------------------------
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[GuidAttribute("81AC67A9-1511-4104-93AC-BD8BFEC93F71")]
[ProgIdAttribute("MyDll.dll")]
public class GetURL: IObjectWithSite, IOleCommandTarget
{
protected SHDocVw.IWebBrowser2
m_pIWebBrowser2; // the browser class object
public GetURL()
{
}
public void SetSite(object pUnkSite)
{
// MessageBox.Show("SetSite");
if (m_pIWebBrowser2!=null)
Release();
if (pUnkSite==null)
return;
IServiceProvider isp = (IServiceProvider)pUnkSite;
try
{
//!!!!!получаем указатель на SHDocVw.IWebBrowser2 через IServiceProvider а не QueryInterface
Guid g1 = typeof(SHDocVw.IWebBrowserApp).GUID;
Guid g2 = typeof(SHDocVw.IWebBrowser2).GUID;
object obj;
//isp.RemoteQueryService( ref g1, ref g2, out m_pIWebBrowser2 );
isp.QueryService( ref g1, ref g2, out obj );
//получили объект и преобразуем его к SHDocVw.IWebBrowser2
m_pIWebBrowser2 = (SHDocVw.IWebBrowser2)obj;
}
catch(System.Runtime.InteropServices.COMException ex)
{
//
}
MessageBox.Show(m_pIWebBrowser2.ToString());
}
public void GetSite(ref System.Guid riid, out object ppvSite)
{
ppvSite = m_pIWebBrowser2;
try
{
//
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + " GetSite");
}
}
public void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, ref OLECMDTEXT CmdText)
{
MessageBox.Show ("Query status");
}
public void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut)
{
MessageBox.Show ("Execing");
}
}
-----------------------------------using----------------------------------------
In what a mistake? Help! Plz!!
|
|
|
|
|
I have two webforms in the same Project, and both have the lines
System.Drawing.Image.GetThumbNailImageAbort myCallback;
These two forms have the same using directives but the weird thing is, one form compiles fine, but the other barfs up the error:
The type or namespace name 'GetThumbNailImageAbort' does not exist in the class or namespace 'System.Drawing.Image' (are you missing an assembly reference?)
Is this a bug? Has anyone seen this before? Or am I just missing something?
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Nick Seng wrote:
Is this a bug? Has anyone seen this before? Or am I just missing something?
You not only need to make sure your code uses a using statement to reference the assembly but you also have to make sure the compiler references the appropriate assembly as well. If you are using Visual Studio .NET you can simply add a reference to System.Drawing.dll, but if you are compiling using the command line compiler you will need to add it to the /reference switch.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Nope, the references are correct and I am using VS.NET.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
How can I disable the Add and Remove buttons in the standard CollectionEditor? I already implemented my own Editor Class but how can I access the buttons because I don't want to create my own form which should look like the standard form. Or do I have to derive a class from CollectionForm and how could I do that? And I really want to disable the buttons and I don't want to display an error message.
Claudia
|
|
|
|
|
Hello,
I want to create a Table in my Smart Device Application which contains a few links which forwared to another form in my Smart Device Application. Has anybody an idea how i can do that?
thx
regards
patrick
|
|
|
|
|
Hi , ive been trying to figure out how ambient properties in .net work.
i know its possible to do something like this:
<br />
private Color blah;<br />
public Color Blah<br />
{<br />
get<br />
{<br />
if (blah == Color.Empty)<br />
{<br />
return this.Parent.Blah;<br />
}<br />
else<br />
{<br />
return blah;<br />
}<br />
}<br />
set<br />
{<br />
if (value == this.Parent.Blah)<br />
{<br />
blah=Color.Empty;<br />
}<br />
else<br />
{<br />
blah = value;<br />
}<br />
}<br />
}
this works fine in runtime but it doesnt behave as the color and font properties of a control in designtime since the ambient value is not treated as the default value.
(the ambient value is always bold in the prop browser and always persisted to the initialize code)
ive used reflector to see how the control class does it and i cant see anything different in their code (except for some offtopic activex compatabillity)
how can i specify a behaviour similair to the "[DefaultValue(..)]" dynamicly ???
i know its possible since the controls does it and they do not even specify the defaultvalue , so it must be some typeconverter related thing , right?
//Roger
|
|
|
|
|
I use the code below for a simple search function in a richtextbox. When I load larger files, and try to search it will always throw an out-of-memory exception. From the debugging it seems to be richTextBox.Find that is the culprit.
For an example, searching File1 that is 1800kB is no problem but File2 at 17000kB will always throw the exception. Opening File2 in, for example Notepad, and search is no problem.
Anyone knows why, is there a limitation with richTextBoxes and why can I then load the file with the Loadfile function?
Is there any workaround for it?
I also ran into another problem, with one specific file I don't get the exception when I search but instead "Failed to load resources from resource file. Please check your setup". I use the default settings and I did run the "fix application". Still it will crash with this message. Any fix for this?
try
{
RichTextBox.SelectionColor = Color.Black;
int searchEnd = RichTextBox.TextLength;
searchStart = RichTextBox.Find(searchTextBox.Text, searchStart, searchEnd, RichTextBoxFinds.MatchCase);
RichTextBox.SelectionColor = Color.Blue;
//RichTextBox.SelectionFont = Font.Bold;
RichTextBox.GetPositionFromCharIndex(searchStart);
RichTextBox.Focus();
RichTextBox.ScrollToCaret();
if ( searchStart < searchEnd ) { searchStart++; }
else { searchStart = 0; }
}
catch (Exception f)
{ MessageBox.Show("Failed to search " + searchFile + "\n" + f.ToString()); }
|
|
|
|
|
Embarrassingly enough I believe the out-of-memory was due to that I dodn't took care of when there was no hit on the search.
The failed to load resources probelm remains though.
|
|
|
|
|
If I keep looping the folloing statement with the new pen with a timer , will it cause a memory leak? I know C++ when you create with new, you have to use delete. But for .NET C# / VB.NET, does this apply? Do I need to use the Dispose statement every time I use the new statement? Please Advise.
mypen = New Pen(Color:=Color.DarkRed, Width:=1)
g = Me.CreateGraphics
g.DrawLine(mypen, 0, 235, 600, 235)
|
|
|
|
|
Most likely the Dispose or Close method closes or releases unmanaged resources which don't underlie the control of the GC.
If the component is well programmed it provides a finalizer which ensures that the unmanaged resources are freed when the call to Dispose was forgotten. As the finalization has an impact on performance it's recommended to call Dispose or Close. Both will suppress the finalization cause the unmanaged resources are already freed.
Take a look at MSDN[^].
www.troschuetz.de
|
|
|
|
|
alternatively you could do:
using (Pen mypen = new Pen(Color.DarkRed, 1))
{
g = this.CreateGraphics();
g.DrawLine(mypen, 0, 235, 600, 235);
}
|
|
|
|
|
|
How to do DataGrid full_row select?
|
|
|
|
|
It's a property of the grid, you either select full rows, or you only select the one cell.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
try this
<br />
<br />
void DataGrid1CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
dataGrid1.Select(dataGrid1.CurrentCell.RowNumber);<br />
}<br />
<br />
|
|
|
|
|
is there a way from a aspx page i can run a program on the computer looking at the web site (the program is alread install on there computers) this is for my intranet not internet
thanks
chad
|
|
|
|
|
You need to ask this in the asp.net board. I'd hope the answer is no. The fact is that the platform that delivers your web page is irrelevant, you need to do it using something you can embed in the page, that IE can read ( for example, Javascript ).
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
I'd hope the answer is no.
Actually the answer is yes. They are typically called href executable, and obviously deal heavily with CAS and the temporary assembly cache. Chris Sells has an example of one here[^]. MSDN has information you can read about here[^].
- Nick Parker My Blog | My Articles
|
|
|
|