|
Is it possible to create an control that has for example a property which has a (self created) property building screen. In this screen you can set the contains of this property. After closing this screen, this screen will generate some code in te code-behind file.
I was hoping someone could tell me if this is possible. With add-ins it could but i want a sexier way. If this is not possible, than can someone tell me if i can make a add-in which will look like the property window in VS.Net?
|
|
|
|
|
Can you help me with a good, from ground up, with pictures and links tutorial - how I can edit HTML document from inside C# ? I readed MSDN articles about MSHTML editing but I'm still have some questions
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
|
10x man !! But I already found the answer.
Some sites to look for:
http://abstractvb.com/code.asp?P=1&F=51 [VB site]
Google.com [try to search for every interface name you found or question about - it's really helps]
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
This is probably a basic question to one who has the answer, but I can't seem to find the forest for the trees.
I put together the main form (frmMain) and I have several user controls that I put together. Silly me, I only tested the process on a single form before moving forward.
I created the main form with a panel (pnlMain) into which I paste my user control (UC). When the user clicks on a button, my intention was to call a public routine in frmMain that would 1) Hide the current UC and then load and paste an appropriate new UC into the panel.
The problem is hierarchy. No matter how I put the controls together, once the child form is open, I can't get back to the main form to tell it to do something different. I've tried a few different variations but I keep running into the hierarchy issue no matter the method of object creation.
I've done this type of thing in Delphi but can't seem to figure out the C# secret.
Thanks for the help.
DBetting
|
|
|
|
|
I not sure I understand your issue. Seems to me there should be many ways to get back to your main from.
Anyway, try this;
Form frmMainRef = (frmMain)this.Parent();
//frmMainRef is a reference to the parent. If you are nested deaply you may need to put this into a loop until ype of frmMainRef is form.
Something like this...
Form frmMainRef = (frmMain)this.Parent();
while(frmMainRef != null && frmMainRef.GetType() == typeof(Form)
{
frmMainRef = (frmMain)this.Parent();
}
good luck, let me know
|
|
|
|
|
For a simple test of visibility and the concept: Given a main form (frmMain) with a panel (pnlMain), using the following:
public class frmMain : System.Windows.Forms.Form<br />
{<br />
...<br />
public ucForm1 UCForm1 = new ucForm1();<br />
public ucForm2 UCForm2 = new ucForm2();<br />
... <br />
public frmMain()<br />
{<br />
InitializeComponent();<br />
UCForm1.Parent = this.pnlMain;<br />
UCForm1.Visible = true;<br />
}<br />
<br />
public void ShowUCForm2()<br />
{<br />
UCForm1.Visible = false;<br />
UCForm1.Parent = null;<br />
UCForm2.Parent = this.pnlMain;<br />
UCForm2.Visible = true;<br />
}<br />
}
then given a User Control with a single button (btnViewOtherForm) using the following:
public class ucForm1 : System.Windows.Forms.UserControl<br />
{<br />
...<br />
private void btnViewOtherForm_Click(object sender, System.EventArgs e)<br />
{ <br />
Form frmParent = (frmMain) this.Parent;<br />
frmParent.ShowUCForm1();<br />
}<br />
}
ucForm2 can be blank. I tried the suggestion, but the reference to ShowUCForm2 cannot be found. I cannot use the loop because the compiler wants to find the reference before it allows it to be used. I've tried several flavors of trying to access the parent, but obviously not the correct one yet.
In this case, the parent should be two levels up. ucForm1.Parent should be pnlMain whose parent should be frmMain.
Thanks
Dan
|
|
|
|
|
I am traveling today. If you wanted to send me the example project, I would work on it during my layover.
|
|
|
|
|
Is there a ClientToScreen() equivalent in c#?
Paul
|
|
|
|
|
|
Thanks,
It is amazing how something so obvious can be so elusive !!
|
|
|
|
|
|
I CAN YOU!
uh... email me.
/\ |_ E X E GG
|
|
|
|
|
Hi All,
I want to connect to Access Database. I am using Visual Studio.NET beta version. In that I want to use the class System.Data.ADO.ADODataSetCommand. But, when I use this in my code i am getting compile time error as
"the type or namespace name 'ADO' does not exists in the class or namespace 'System.Data' are you missing an Assembly reference.". In my 'References' 'System.Data' is present.
Can anybody tell me what specific assembly reference should I add to get 'ADO' namespace inside 'Data' namespace.
Thanks in advance.
regards,
Pranoti
|
|
|
|
|
I saw and used ADO in VB but most recently I was working with Access and C#. I used OleDb and it worked fine.
|
|
|
|
|
Hi,
Can you please tell me how can I use OleDB to connect with access.
Many Thanks,
Pranoti
|
|
|
|
|
In this area, I'm still very much an amateur. Your best bet would be to move your question to the SQL / ADO / ADO.Net section. You'll probably have half a dozen responses.
db
|
|
|
|
|
Hi all,
I am trying to use some custom resources. The following code works with images.
private void Form1_Load(object sender, System.EventArgs e)<br />
{ <br />
image1 = new Bitmap(GetType(),"icon1.png");<br />
image2 = new Bitmap(GetType(),"icon2.png");<br />
SelectionCursor = new Cursor(GetType(),"Cursor1.cur"); <br />
<br />
this.pictureBox1.BackgroundImage = image1; <br />
}
but when I try to change the current cursor as shown in the code below, I get the default IBeam.
private void AttachIcon(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if (e.Button.Equals(MouseButtons.Left)) Cursor.Current = SelectionCursor;<br />
}
There are no compiler errors or warnings. The Cursor1.cur build action property is set to embedded resource. SelectionCursor is declared in the form as private Cursor SelectionCursor; Oh, and it works if I use a different system cursor in the event handler.
Does anyone have a sugestion?
Thanks, Paul
|
|
|
|
|
Got it!
The cursor was 32x32 and needed to be 16x16.
Paul
|
|
|
|
|
Be careful with code like this:
Paul Silvernail wrote:
private void Form1_Load(object sender, System.EventArgs e)
{
image1 = new Bitmap(GetType(),"icon1.png");
image2 = new Bitmap(GetType(),"icon2.png");
SelectionCursor = new Cursor(GetType(),"Cursor1.cur");
this.pictureBox1.BackgroundImage = image1;
}
If you create a new form which inherits from Form1 , but doesn't exist in the same namespace or assembly; the constructors will throw an exception because the resource can't be found. GetType() will return a Type object for the new form, not for Form1 resulting in the exception.
A better way to do it is to use typeof(Form1) so that you will always be referencing the correct Type object.
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
Hi,
I'm trying to add in an ImageList >3000 icons. It takes a lot of time. How can I do it work faster ? This ImageList will be used for viewing in Listview.
Thanks in advance
|
|
|
|
|
You wanna use a technic called using an imagestrip. The is some docs on MSDN how to do this, but basically you create a single really long image and load that into the imagelist. The rest is taken care off AFAIK.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hi,
Sorry about putting this in the ASP.NET forum as well...
I've been developing an ASP.NET website for quite some time. The site is located on a w2k server and I have been using remote debugging, which was working quite fine. Took some time to get there though... but it worked just as it should.
Then suddenly, I cannot debug anymore ! I open VS (2003 btw.), open the project and press CTRL-F5 - the site opens in a browser and works fine. But if I press F5 instead, VS opens misc. debug windows (locals, call stack etc), writes "Run" in the caption - but no browser window shows up. Followingly, VS is locked up - it just doesn't respond. Then I can open a browser window manually and go to a page I know I have a breakpoint in, and VS will break at that point - however, still locked up. After that, all I can do is terminate the asp worker thread on the server and kill the VS process on the client. Very strange...
Anybody who has any ideas at all ? I've tried with different startup pages - but with the same result.
Thanks in advance.
Jan Hansen
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
|
I'm trying to develop a custom component library in C#. One of the set of objects in these components would be dropdown controls (DateTime picker with dropdown calender, Numeric edit with dropdown calculator, dropdown tree control, etc.)
From what I understand, for these objects (calendar, calculator, tree, etc.) to drop down in the "correct" way, they shouldn't be forms, but actually WS_POPUP windows that have the desktop as their parents. I'm imagining they should capture the mouse as soon as they drop down, report to their owner (textbox, or whatever dropped them down) and then release the mouse. Am I missing something? Is this the correct approach?
Problem number two. Is the following methodology right: I should define an interface (IPopupControl) and implement it with every desendant (like for instance: DropDownTreeView: TreeView, IPopupControl). The reason is then I should be able to assign any dropdown control to an owner, and then the owner would always call a method (like IPopupControl.Popup) because it will always be implemented. So in other words, the owner will always be accepting one object [object?] which is IPopupControl instead of a specific object (DropDownXXXX) according to what it wants to drop down. Then of course, every dropdown control will implement its own methods that are different, to report the data back to the owner control (most probably textbox).
I would have to call some Windows APIs in this process I would imagine. What are the disadvantages?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|