|
Hi,
Can anyone point me to a free DataGrid better than the one which comes with VS.Net, and that support binding to a DataView/DataTable?
Thanks,
Andrei Matei
andreimatei@home.ro
|
|
|
|
|
Where should be the resource files should exist?
Is it in the application directory or bin/debug (release) directory??
If I keep the resource (.ico) in Project directory, it complains at runtime. Could not find file "C:\Project\bin\Debug\Icon1.ico".
I added this resource to the project and using it like this:
private System.Drawing.Icon myTrayIcon = new Icon("Icon1.ico");
It works properly with the app icon. (App.ico)
Why don't they have the "res" folder option (like Visual C++) in C#?
Don't and drive.
|
|
|
|
|
Resources require a special handling. It's not enough to right-click on the resource from the project hierarchy and select "embed resource" from the options.
I am talking with VC#.NET 2K2 in front of me, and I don't know yet if anything has changed in 2K3.
To add arbitrary resource files (not only icons) to a target assembly, you have to add the /win32res:<filename> to the csc.exe command line.
|
|
|
|
|
Because in .NET you can add an entire set of files, easily to any assembly.
1. Click on the file you want to add as a resource to your application and on the Build Action select "Embedded Resource"
2. Your code will need to be a little more complicated. You'll need to do something like this (I'm not in the IDE ATM, but you'll get the idea):
private System.Drawing.Icon myTrayIcon;
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream st = asm.GetManifestResourceStream(asm.GetName().Name + "." + "Icon1.ico")))
{
myTrayIcon = new Icon(st);
}
See? The embedded resources are available as streams. You you think twice, this is very powerful, as anything that can take a Stream as a parameter can use a resource, without any need for special treatment for resources, like in MFC. You can easily create encrypted or compressed resources with it, too.
And, contrary to what S.Rod. has said, you can add any file as a resource. The only drawback is that it won't be a Win32 resource, but as long as you keep with managed code, you won't have any trouble.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Daniel Turini wrote:
And, contrary to what S.Rod. has said, you can add any file as a resource. The only drawback is that it won't be a Win32 resource, but as long as you keep with managed code, you won't have any trouble.
Agreed.
|
|
|
|
|
|
Wow...so to just to add a new icon resource the above mentioned stuff needs to done!!!
So all this logic is included for App.ico? (the default icon for a form)
Thx for ur hlp.
Don't and drive.
|
|
|
|
|
I am working with IE Browser Control. When a new window event occurs I get that breakpoint no problem by implementing an axWebBrowser1_NewWindow2 method in my form.
However, I seem unable to get a handle to the new browser for that new window.
I am trying to set the ppDisp of the event like this:
e.ppDisp = axWebBrowser2.Application;
This allows the new window to show up, but I'm not sure that my axWebBrowser2 object is actually being used ?
I am unable to tie into its DocumentComplete event ? That is my question.
I tried setting a delegate to it like this:
axWebBrowser2 = new AxSHDocVw.AxWebBrowser();
this.axWebBrowser2.Application.DocumentComplete += new AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.testHandler);
The "testHandler(sender,event)" method is not being called when the new window shows and its document is loaded ?
Thanks in advance for any help on this - mike.
Zeno Rocks
|
|
|
|
|
This code works for me (OnDocumentComplete is triggered from the right Form instance) :
private void OnNewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
{
Form1 newwindow = new Form1();
newwindow.Text = "(new browser window)";
e.ppDisp = newwindow.axWebBrowser1.Application;
newwindow.Show();
}
|
|
|
|
|
Thanks to .S.Rod for the suggestion. I was missing the form. Yeah this seems to now work - great !!
Zeno Rocks
|
|
|
|
|
Is there any way to append RTF text from one RichTextBox control to another
RichTextBox control.
Sonork ID 100:25668
|
|
|
|
|
I've not had a need to work with the C# RichTextBox, but with the ActiveX one, you could do
rtf1.SelRTF=rtf1.SelRTF + rtf2.SelRTF;
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I tried following already but do no seem to work.
rtbMessage.SelectAll();
rtbDisplay.SelectAll();
rtbDisplay.SelectedRtf = rtbDisplay.SelectedRtf + rtbMessage.SelectedRtf;
Sonork ID 100:25668
|
|
|
|
|
Hi !
I've created my custom browser using the AxSHDocVw.AxWebBrowser
The object created is called with in a form that I developed.
Now when I maximize the parent window the child window ( the AxWebBrowser )
is not maximized with it.
I've used the following piece of code to handle the problem bu tit doesn't seem to work.
this.myBrowserInstance = new AxSHDocVw.AxWebBrowser();
InitializeComponent()
{
...
this.MaximizedBoundsChanged += new System.EventHandler(this.Form1_Maximize);
...
}
private void Form1_Maximize(object sender, System.EventArgs e)
{
...
System.Drawing.Size sizeOfBrowser = new System.Drawing.Size
(this.MaximizedBounds.Width - 10, this.MaximizedBounds.Height - 10);
myBrowserInstance.ClientSize= sizeOfBrowser;
...
}
Please help !
Thanx in Advance !!
((
|
|
|
|
|
This code is irrelevant.
To make sure the web browser is maximized or scaled accordingly to the parent window, you can use anchors/docks from the IDE / Properties.
|
|
|
|
|
Thank you very much
|
|
|
|
|
I have the following function:
void IVSSItem.Get(ref string Local, int Flags)
I try to use it the following way:
string fullPath = "some path";
vssItem.Get(fullPath, 0);
I get the following compilation error:
Argument '1': cannot convert from 'string' to 'ref string'
Anyone know how to use a ref string ? I tried typecasting, using the class String , and declaring the fullPath local var to be of type ref string , to no avail.
|
|
|
|
|
|
Tx Dan
|
|
|
|
|
How do you do that? In C, I would have done something like:
FileAttributes &= ~ReadOnly;
How do I do that in C#?
|
|
|
|
|
|
And what was the answer? I am having the same problem figuring this out...
|
|
|
|
|
Alright,
Heres my question for all of you guru's out there. I have a main form, which is a mdi container. Inside this mdi container, aligned to the left side, is a tree view control with various menu options. When a user selects an option from the treeview control, various "main" forms are loaded, which stretch from the right side of the tree view control onto the rest of the form. Almost as if you had your favorites toolbar open on internet explorer. Now from each main form, you can navigate to a from from this main form. For instance, if the main from displayed various personnel with a datagrid control, you could hit an edit button, and have a form replace the main from with a personnel edit form. So it is possible to navigate forms from the treeview control and the various main forms that the treeview loads. The tricky part is this, I have to beable to implement back and foward buttons for the application, just like in IE. So what Im doing is creating a method of the main, container form.
Something like this
private void HandleForms(Form frmCurrent)
{
try
{
if(frmCurrent != null)
{
if(m_cCurrent != null)
{
m_cCurrent.Close();
}
m_cCurrent = frmCurrent;
m_cCurrent.MdiParent = this;
m_cCurrent.Dock = DockStyle.Right;
//m_cCurrent.SetDelegates(m_dlgNotifyMain)
m_cCurrent.Show();
m_aForms.Add(m_cCurrent); //arraylist of forms for back foward
}
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
As you can see, I just simply set a member level form variable equal to
whatever form that the method is passed. I close the previous form and
load the new form. But in order from me to allow the main forms to also
load there own edit forms for example, I need to pass a delegate reference
to those main forms, hence my commented out setdelegate method call. It obviously wont let me use a method call on the generic form class like that. Because the form class could be set equal to any of 10 different forms. Im totally at a loss, here are my main problems
1. If i need to pass a delegate reference to a newly loaded form, and your
not positive at design time which form you need to pass the delegate, how do you accomplish this. I wasnt able to get casting to work, or an interface.
If anyone could help me or point me to a tutorial or something I would greatly appreciate it.
Ryan
|
|
|
|
|
Ryan@SalamanderTechnologies wrote:
If i need to pass a delegate reference to a newly loaded form, and your
not positive at design time which form you need to pass the delegate, how do you accomplish this. I wasnt able to get casting to work, or an interface.
Simply pass the reference to the base class: Form.
BTW, I'd bet that this would be easier to implement with each form as a property page or user control, since MDI is, as the name states, document oriented, you'll soon bang your head in some wall.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Well how would I pass the reference to the base class? I created methods with in ech of the forms called SetDelegates(passed delegate) which allowed me to do this. How would I pass it to the Form base?
Thanks for your reply,
Ryan
|
|
|
|