|
Thanks a lot.. . It worked..
|
|
|
|
|
It may belong under WTF or Soapbox, but I just found this:
The value of the HelpButton property is ignored if the Maximize or Minimize buttons are shown.
Does anyone here have an easy workaround that allows all three buttons to be on the Caption Bar?
(Using .net 2.0)
|
|
|
|
|
It's not an easy workaround: you'll need to paint it on the title bar yourself. For that you need to handle the WM_NCPAINT and WM_NCHITTEST messages. See DrawFrameControl for how to draw a Windows 2000-style help button (DFC_CAPTION and DFCS_CAPTIONHELP ) and DrawThemeBackground /DrawThemeIcon (part WP_HELPBUTTON and the appropriate state) for Windows XP-style themed buttons.
For Windows Vista it probably won't work very well since Aero draws the title bars normally, if in 3D mode; if you handle WM_NCPAINT it will turn off the standard frame painting for that window, I believe. You'd probably have to start playing with the Glass API to make it still look like a Windows Vista window.
The limitation is from Windows itself: the documentation for CreateWindowEx says "WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles." In other words, Microsoft did not intend it to be used like this.
Edit: yes, I realise this is the Windows Forms forum. You need to override the WndProc method to handle messages that Windows Forms doesn't already translate to method calls/events.
|
|
|
|
|
hi friends,
i am creating an application in c# and i want it to run at windows, i have added it in Registry (hkey_current_user\software\microsoft\windwos\run) but still it is still not running....what else to do ? please answer this question as soon as possible.
|
|
|
|
|
Copy .exe file of your application in the StartUp folder on your PC ....Otherwise I think you have to make your application as a Windows Service....
Tirtha
"A man can ride on your back only when it is bent....."
|
|
|
|
|
This app won't run at Windows startup. You told the registry to launch it when a user logs on.
Also, if it's not starting up AT ALL when a user logs on, you have to check to see if the path to your .EXE you specified is accurate.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
I have some old project that implement some GUI in MFC.
I need to change one of the dialog in this GUI - and i found out that i can do it in very easy way in C#.
Can / How can i mix between those two language ? i want to do in in the easy way - but i don't want to write all the application in C# ... Someone have a idea ?
Thanks for any help.
|
|
|
|
|
Yanshof wrote: How can i mix between those two language ?
You can turn on a flag that makes your C++ code able to use managed classes, and write a managed wrapper for the C++ classes you want to reuse in .NET. C++/CLI is what you're looking to do.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I'm developing a GUI with Windows Forms and would like to be able to change the 'look and feel' of the whole GUI from one place - essentially apply a Visual Style to it. But I want to be able to change the size and font of all the text in the app when I do so: including both Labels and the text displayed in buttons, listboxes etc.
I realise that Labels (and a couple of other components) ignore Visual Styles. Is there a way I can force them to obey a visual style, or some other way to define and apply a consistent visual scheme to the GUI, including the text? (I'm working in C# .NET 2.0)
Thanks very much,
Keiron
|
|
|
|
|
Upgrade to WPF and .NET 3. Seriously, this is relatively trivial in WPF (there are a couple of little gotchas). Failing that, there's always this http://www.codeproject.com/cs/miscctrl/StylesSheetManager.asp[^]. I've never tried it, but it looks like it could be pretty decent.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks very much Pete. Unfortunately upgrading to .NET 3.0 isn't really an option (I'm writing plugins for a .NET 2.0 app) but I'll give StylesSheetManager a go. Cheers!
Keiron
|
|
|
|
|
Hi.
I'm new to ADO.NET, and clearly this question has been asked in different forms before, but nothing I'm reading is working. I'm writing a little sample Windows Forms app that is supposed to display the contents of a table in a database. I've got a simple "add row" button to add a new row, and I'd like to see my DataGridView show the changes when the row is added. The row gets added, but my DataGridView doesn't show it. Shouldn't I be able to register for an event that is fired when my database is updated (or is my DataSet?).
I've tried calling EventsTableAdapter.Update, EventsBindingSource.ResetBindings, DataGridView.Refresh... all to no avail.
Relevant source code to follow...
public partial class Viewer : Form
{
private long m_NextEventID = 1;
public Viewer()
{
InitializeComponent();
}
private void Viewer_Load(object sender, EventArgs e)
{
this.eventsTableAdapter.Fill(this.dDBDataSet.Events);
}
// called on button click, to add a new row to my database.
private void m_NewEasyEntryButton_Click(object sender, EventArgs e)
{
this.eventsTableAdapter.Insert( m_NextEventID++, DateTime.Now,
DateTime.Now, false, 1, "Wrong Number", "This is a test");
// not working?!!
this.eventsTableAdapter.Update(this.eventsTableAdapter.GetData());
this.eventsBindingSource.ResetBindings(false);
this.m_DDBGridView.Refresh();
}
}
private void InitializeComponent()
{
...
this.eventsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dDBDataSet = new DiagViewer.DDBDataSet();
this.eventsTableAdapter = new DiagViewer.DDBDataSetTableAdapters.EventsTableAdapter();
this.m_NewEasyEntryButton = new System.Windows.Forms.Button();
this.m_UpdateNowButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.m_DDBGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.eventsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dDBDataSet)).BeginInit();
this.SuspendLayout();
//
// m_DDBGridView
//
this.m_DDBGridView.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.eventsBindingSource, "ID", true));
this.m_DDBGridView.DataSource = this.eventsBindingSource;
//
// eventsBindingSource
//
this.eventsBindingSource.DataMember = "Events";
this.eventsBindingSource.DataSource = this.dDBDataSet;
//
// dDBDataSet
//
this.dDBDataSet.DataSetName = "DDBDataSet";
this.dDBDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// eventsTableAdapter
//
this.eventsTableAdapter.ClearBeforeFill = true;
//
// m_NewEasyEntryButton
//
this.m_NewEasyEntryButton.Location = new System.Drawing.Point(104, 310);
this.m_NewEasyEntryButton.Name = "m_NewEasyEntryButton";
this.m_NewEasyEntryButton.Size = new System.Drawing.Size(75, 23);
this.m_NewEasyEntryButton.TabIndex = 1;
this.m_NewEasyEntryButton.Text = "Easy Entry";
this.m_NewEasyEntryButton.UseVisualStyleBackColor = true;
this.m_NewEasyEntryButton.Click += new System.EventHandler(this.m_NewEasyEntryButton_Click);
}
|
|
|
|
|
The quickest solution is to call "this.eventsTableAdapter.Fill(this.dDBDataSet.Events)" after you insert the row. But this causes the entire grid to refresh, loosing the users scroll position and selection in the process.
The problem is that the row gets added to the database, but is not added to the table adapter. The Fill method reloads the data from the database into the table adapter.
The things you tried weren't working for various reasons. The Update method writes the changes that you just made to the database. It doesn't load changes back from the database. ResetBindings and Refresh didn't operate on the table adapter itself, which is what lacked the up-to-date data.
There may be a more complex solution to force the table adapter to load just the inserted row, but I don't know of it.
As an alternative to data binding, you might want to consider http://updatecontrols.net. These controls keep themselves up-to-date as your data changes. They don't bind directly to the database. Instead, they observe changes in your own data objects.
|
|
|
|
|
Dear RabidHamster,
Thanks very much for your timely, well-written, and complete response. I finally tried the Fill method, and deduced what was going on. I understood everything you said (and updatecontrols.net looks interesting!), but I feel I have to ask my question a little more deeply.
Here's my bigger-picture problem. I want to use a database as a repository for diagnostics from my application (essentially like a log file -- on steroids). This will be updated by multiple processes, possibly distributed on a network, and I'd like to view it both "live," as the data comes in, and in an "analysis mode" where I have more sorting and filtering capability.
I suppose I'll end up using a DataReader to do the "live" viewing, since it's lightweight and faster, and then I'll build a console window of sorts around that. I'll use a data-bound DataGridView of some sort to do the analysis features, which can be done on "snapshots" of the database. But even for the "snapshot" mode -- and especially for the "live" view, I want any UI to have the ability to know about changes to the database, since it's the central repository of information.
Are you really saying there's no built in event mechanism that I can tap into that responds to changes to the database itself? Am I going to have to implement some sort of polling mechanism to check for changes -- and maybe fire those events myself? (and if so, what do I check for?)
Thanks again.
|
|
|
|
|
Ummm... I think I might have found the answer to my problem:
http://www.codeproject.com/cs/database/chatter.asp
|
|
|
|
|
Hi,
I want some instructions in converting existing C# Windows Application to C# Web Application..
Please post your replies as soon as possible.
|
|
|
|
|
If the application has been properly architected it should just be a matter of rewriting the presentation (UI) layer - perhaps with the odd addition elsewhere to support a stateless model of working. If it hasn't been well architected then you are looking at rewriting the whole application.
|
|
|
|
|
Spamming different 10 forums with the same question is very rude and totally unnecessary.
But, the Windows Forms forum is probably the most appropriate place for the question. The answer still doesn't change. If not properly architected, you're looking at a total rewrite, from the ground up.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
I'm hoping someone who knows more about Reflection or the internals of the framework than me can help me out on this one.
I'm working on a very large and complex winforms 2.0 in VB.Net 2.0. We will have quite a few different types of users (eg: Data admin, viewer, editor, business rules manager, etc) and I have been tasked with designing and implementing the security model that handles what each user can do. I intend to base it on our own in-house User, User Role and Permissions oracle 9i tables (ie: a pretty standard security model.)
Someone suggested that rather than having a call to some method like SecurityModule.CheckUserPermission() in every method I could Reflection to find out what method was currently invoked (how?!) and then check the user permission against a table (loaded into memory) which would contain the user's role and therefore whether they had a right to use that method. For example the AddNewEmployee() method might only be available to the "DataAdmin" and the "HRAdmin" roles and all others would not be allowed to execute the method - it would just give them an appropriate dialog.
So does anyone have any thoughts on how to do this? If the above idea is workable can someone point me in the right direction to get started? I've hardly ever used Reflection so am not sure how to go about designing this. Otherwise does anybody have any better ideas for a security model than having to place CheckUserPermission() calls all through this very large app?
TIA for any help/info/suggestions.
Mike
|
|
|
|
|
To get the method you are in, you can use the System.Diagnostics.StackFrame class. You would use new StackFrame().GetMethod().Name . Note however, that it is going to be expensive to use reflection to retrieve permissions for users using Reflection based on the called method, and you are relying on developers remembering to put the necessary "plumbing" code into each method. (Either that, or you are going to be injecting code into every method - and that is a whole different can of worms).
I've done similar to this in the past, and used Extender Providers to control what is available to a user. Shameless plug here - this article http://www.codeproject.com/useritems/AutoEnableUI.asp[^] shows the basics of how to do this. Extending it to use your role model should be fairly trivial.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks Pete - I really appreciate the reply... it gives me somewhere to start at least.
Cheers,
Mike
|
|
|
|
|
If I have a populated dataGrid in visual c++, how can I get values from the dataGrid without going to the underlying dataSet.
Is there a way to use dataGrid->currentRowIndex to reference the row and then return the value from a given column.
Thanks!!
Kim
|
|
|
|
|
Create an object as datarow and the take all the data of ur datagrid column to that object and then refer it..
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
Hi I am new to programming
Could someone tell me where i could find the simple coding statements for FileToolStripMenuItem_Click? Example i want to write code to "New" "Open"?
IS there a website that can teach me the functions for opening and functionality of menu's
Now this is what i put in =>
Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked
Edit()
Copy()
Please help thanks
Preppy programmer
-- modified at 21:44 Thursday 15th March, 2007
|
|
|
|
|
Maybe this could help you:
http://www.c-sharpcorner.com/UploadFile/ggaganesh/WorkingwithMenusinCSharp11282005004421AM/WorkingwithMenusinCSharp.aspx
|
|
|
|