|
Is it possible to show the menu in a windows form from a form which is not its MDI parent?
Thanks,
Sandeep
+919891027854
|
|
|
|
|
It should be possible. Have you added a MainMenu (.NET 1.x) or MenuStrip (.NET 2.0) to your MDI child window?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I have added MainMenu on ur suggestion into MDI child window but the click event of the original menu does not work in the child window...
plz give some advice...
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Well, no. You'll get the Click events for the top-level menu in the parent form, and for the child's menu in the child window.
Basically the top-level menu should contain items related to the application as a whole, while child menu items should apply to the particular child window (or document.)
There's also menu merging, in which child menu items merge into the toplevel menu. This way, the toplevel menu displays application-wide menu items *and* commands for the current child window. You can see this in Visual Studio, where the menu bar changes according to the type of window (code window, form designer, and so on).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I am having one MDI form in which there is a child form which has its own menu. I then opens a form using this child form's menu and taking Main Form as MDI parent of that form.
Now I want to show the menu of the previous form from whivh I opened this form with same click events for the form as the previous one was having. I am not having any menu on this newly opened form. How can I do it?
I want toread ur web page in English, I don't know Spanish... I am the reader of ur blog....
Thanks,
Sandeep
+919891027854
|
|
|
|
|
If the second child window is of the same type (class, say ChildForm) as the first child, it should have the same menu. If it's a different type, then you must add the menu and code manually.
You should have something like this:
class MainForm : Form
{
...
private void menuNewForm_Click(object sender, EventArgs e)
{
ChildFormWithMenu form = new ChildFormWithMenu();
form.MdiParent = this;
form.Show();
}
}
class ChildFormWithMenu : Form
{
... (create MainMenu in the desginer and menu items) ...
private void menuOneMoreForm_Click(object sender, EventArgs e)
{
ChildFormWithMenu form = new ChildFormWithMenu();
form.MdiParent = this.MdiParent;
form.Show();
}
private void menuNewFormWithoutMenu_Click(object sender, EventArgs e)
{
SomeOtherChildForm form = new SomeOtherChildForm();
form.MdiParent = this.MdiParent;
form.Show();
}
} I hope I have made myself clear!
MudkiSekhon wrote: I want toread ur web page in English, I don't know Spanish... I am the reader of ur blog....
I'll respond there when the page opens but having our web page in English is not a current priority. We have a lot of work for customers, and altough we sure would like to have it in English, we just don't have time for it right now. But thanks for stopping by!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi all,
I got a pressing question which i needed help answering. I have develop a crystal report in vs 2003.net using c#. I am able to run it smoothly on the development machine. However when i deploy it at the client side, the crystal report keep prompting me to log in although i have hardcoded the logOnInfo.
A part of the code:
CrystalReport1 rsource = new CrystalReport1();
rsource.SetDatabaseLogon("uid", "pwd", "server1","db1");
this.crystalReportViewer1.LogOnInfo = new TableLogOnInfo();
this.crystalReportViewer1.LogOnInfo.Add(logOnInfo);
this.crystalReportViewer1.ReportSource = rsource;
Any idea wat went wrong?
|
|
|
|
|
try it
--
ReportDocument *rptdoc = new ReportDocument();
rptdoc->Load("c:\temp\1.rpt"); //crystal report template filename
rptdoc->SetDatabaseLogon("userid", "password", "server", "database");
this->crystalReportViewer->ReportSource = rptdoc;
--
hoping this help.
|
|
|
|
|
Hello,
i am having endless problems logging-in at a website with the HttpWebRequest and SSL authentication.
I have done the following:
Went to the site and clicked the Lock icon in the browser which opened the certifiate window. I then Installed the certificate and after that i expored it as a .CER file
I then uses this Certificate in my HttpWebRequest.
this.oCertificate = X509Certificate.CreateFromCertFile("the file"<-removed full path); // doesnt complain about path
As i think this will be what is called Client Authentication (only) i set the following delegate
ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true; // ps. the sslPolicy gives me None
};
Request.ClientCertificates.Add(oCertificate);
Soo then i make my request to the site and retrives the data and Request and Response headers.
But there is no difference at all whether i use the Certificate or not.
In my WebBrowser when using a http sniffer program it always sets the Cookie: RSP-KEY and other information in the first request to the site (both in GET and POST), but none of the information are set when i make a HttpWebRequest!
What am i doing wrong ? / missing ?
Hope someone can help me
Martin
|
|
|
|
|
Hello all,
I am new to C# and Windows programming student. I am wokring on a DataGrid and I tried to customize it a little. But whenever I click all the cells get highlighted excpet the one I custmized, here is the code:
public class PaintedColumnStyle:DataGridTextBoxColumn
{
protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
{
foreBrush = new SolidBrush(GetColor(GetColumnValueAtRow(source,rowNum)));
if(GetColumnValueAtRow(source,rowNum) != DBNull.Value)
{
object txt;
decimal Num;
txt = GetColumnValueAtRow(source,rowNum);
if(txt.GetType() == typeof(decimal) )
{
Num = (decimal)txt;
}
else
{
Num = decimal.Parse((string)txt);
}
if(Num < 0)
{
backBrush = new SolidBrush(GetBackColor(GetColumnValueAtRow(source,rowNum)));
}
else
{
backBrush = new LinearGradientBrush(bounds,
Color.FromArgb(255, 255, 255),
Color.FromArgb(13, 150, 255),
92,false);
}
}
base.Paint (g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
}
Pleaes click here to see the pictuer[^]
I am thinking that my 'override Paint' overrides when I click to highlight a row as well.
I am attaching a picture here so you may have a better understanding. Please help a newbie
|
|
|
|
|
Hi rhr,
May be what happens is that you clicked on that specific column, and you know just like in excel / a spreadsheet, when you do a selection the currently active cell always look different in the selection you know?? just wondering...
So in the end it looks like it's not selected, but it's the currently active cell, as well as part of the selection. Possible
daniero
|
|
|
|
|
While you have handled the fore and background colors for the textbox, I don't believe you have handled the selectedfore and selectedbackground colors. I know in my use of datagridviews and excal VSTO programming, I've forgotten to set those and been confused with that as well. Hope this helps.
|
|
|
|
|
Sounds like a reasonable explaination to me. Where do I need to set the SelectedForegound and SelectedBackGround? Is it like a property or do i need to override something? Thanks a lot for your help though.
|
|
|
|
|
Here is where I am setting the SelectedForeground and SelectedBackground:
<code>
DataGridTableStyle dgTableStyle = new DataGridTableStyle();
DataGridTextBoxColumn dgCheckNumber = new DataGridTextBoxColumn();
DataGridTextBoxColumn dgDateColumn = new DataGridTextBoxColumn();
DataGridTextBoxColumn dgCCtrans = new DataGridTextBoxColumn();
PaintedColumnStyle dgAmountColumn = new PaintedColumnStyle();
DataGridTextBoxColumn dgBalanceColumn = new DataGridTextBoxColumn();
DataGridTextBoxColumn dgCommentColumn = new DataGridTextBoxColumn();
PaintedColumnStyle dgPaintedColumn = new PaintedColumnStyle();
</code>
dgTC.TableStyles.AddRange(new DataGridTableStyle[] {dgTableStyle});
dgTableStyle.DataGrid = dgTC;
dgTableStyle.AllowSorting = true;
dgTableStyle.AlternatingBackColor = Color.GhostWhite;
dgTableStyle.BackColor = Color.GhostWhite;
dgTableStyle.GridLineColor = Color.RoyalBlue;
dgTableStyle.HeaderBackColor = Color.MidnightBlue;
dgTableStyle.HeaderForeColor = Color.Lavender;
dgTableStyle.LinkColor = Color.Teal;
dgTableStyle.SelectionBackColor = Color.Teal;
dgTableStyle.SelectionForeColor = Color.PaleGreen;
dgTableStyle.ForeColor = Color.MidnightBlue;
dgTableStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[]
{dgPaintedColumn,dgCheckNumber,dgDateColumn,dgCCtrans,dgAmountColumn,dgBalanc
eColumn,dgCommentColumn});
Could you please tell me where elase do I need to set the SeletionForeColor and SelectionBackColor in order to get these to apply to my custom column?
Thanks a bunch
|
|
|
|
|
Hello,
I have developed a little generics class that derives from a Form-derived class:
class SingletonChildForm<T> : ChildFormBase
{
private static SingletonChildFormHelper theForm =
new SingletonChildFormHelper(typeof(T));
public static ChildFormBase CreateOrActivate(Form parent)
{
return theForm.CreateOrActivate(parent);
}
}
and I derive some other forms from it:
partial class UserCatalogForm : SingletonChildForm<UserCatalogForm>
{
public UserCatalogForm()
{
InitializeComponent();
}
}
Everything works as expected, but there is one little problem: I can't open the UserCatalogForm on the designer. I get this error:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: UserCatalogForm --- The base class 'Sic.Client.SingletonChildForm' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
The project compiles and runs OK, but the designer just can't open the file. It seems to me that the designer just can't handle a generic type as a base class.
So, has anyone been in a similar scneario before? Ideas?
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-- modified at 11:05 Friday 13th January, 2006
|
|
|
|
|
|
Hello all!
I am using a C# program and would like to generate the exe file from the source code. Can anyone provide some help. I look for msdn but not found.
Thanks All,
Tran Dung
|
|
|
|
|
I don't understand. Do you mean you want your program to compile an exe from source code ? The way to do this is to call the command line compiler.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes, I want my program to compile an exe file from source code.
or complie another program to make an exe file.
Can you provide some help.
Thank you very much.
Tran Dung
|
|
|
|
|
|
Thanks Christian Graus
Tran Dung
|
|
|
|
|
Any idea why I get a "An unhandled exception of type 'System.NullReferenceException' occurred in MyApp.exe. Additional information: Object reference not set to an instance of an object" on the last line of the following code? When I put WordApp.Selection in the Watch window, it says <undefined value="">. I copied this process right from the book. The app is early bound to Word.
public class ReplaceWord : IDisposable
{
private Word.Application WordApp=null;
object readOnly = false;
object isVisible = false;
object replaceAll = Word.WdReplace.wdReplaceAll;
object missing = System.Reflection.Missing.Value;
public ReplaceWord()
{
if (WordApp==null) WordApp = new Word.ApplicationClass();
}
public void SearchAndReplace( object fileName )
{
Word.Document aDoc = WordApp.Documents.Open(
ref fileName, ref missing,
ref readOnly, ref missing, ref missing,
ref missing,ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible,
ref missing, ref missing, ref missing );
//Move selection to the beginning of doc.
Object unit = Word.WdUnits.wdStory;
Object extend = Word.WdMovementType.wdMove;
WordApp.Selection.HomeKey(ref unit, ref extend);
Cliff Anderson
Lockheed Martin Corp.
|
|
|
|
|
When you get a System.NullReferenceException , typically you are trying to access a field, property method, event of an object that is null. Have you tried steping through the code, if it occurs on the last line, it is possible that either WordApp or Selection could be null.
|
|
|
|
|
How can i protect my password for connection to the Microsoft Access Database?
Can i use Store Procedure with Access Database?
|
|
|
|
|
Sasuko wrote: Can i use Store Procedure with Access Database?
I believe that is possible, nowadays.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|