|
yep... I have posted it there also and got some useful responses. at present i am workin on their replies and links given....
anyway thanks for ur advice... and sorry for posting it over here
Suman
|
|
|
|
|
no problem, sorry i wasn't able to help more.
Good Luck solving your problem
Kev
|
|
|
|
|
Hi guys,
I am working on an interface and I want to include a 'close' item in my file menu otehr then exit. So, that when i click 'close' item the current active document closes without exiting the interface.
I defined the menu item and all tht stuff (designer code)... but i don't know how to write a routine for it.
any help is appreciated.
thanks,
Suman
|
|
|
|
|
Just call Close() method of the active mdi child
|
|
|
|
|
hi,
You can call close() method of your base form. This will close your form without giving any notification that it is closeing. But i can tell you this not a way to design application. What i mean to say is , when your click on close button or sub menu. Then we can ask whether want to close or not. That is here you need to execute some of your logic while closeing your application. To achive this what you can do is, try to override the oncloseing event of your base form.
eg.
protected override void OnClosing(CancelEventArgs e)<br />
{<br />
<br />
try<br />
{<br />
if(MessageBox.Show("This Will Close Me. Do You Want To Continue ? ","Conformation",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.No)<br />
e.Cancel = true;<br />
else<br />
e.Cancel = false;<br />
base.OnClosing (e);<br />
<br />
}<br />
catch(Exception Ex)<br />
{<br />
MessageBox.Show("Sorry For This Inconvenience.","Information",MessageBoxButtons.OK,MessageBoxIcon.Information);<br />
<br />
}<br />
}
and one more thing suppose if you want to exit your entire application then close won't serve you. There you can call Application.Exit() to exit your entire application. Hope this will help you out.
Sreejith Nair
|
|
|
|
|
Hi Sreejith,
Here are my actual declarations look like....
// FileExit (which closes the application)
//
this.FileExit.Index = 2;
this.FileExit.Shortcut = System.Windows.Forms.Shortcut.CtrlE;
this.FileExit.Text = "Exit";
this.FileExit.Click += new System.EventHandler(this.File_Exit);
private void File_Exit(object sender, System.EventArgs e)
{
this.Close();
}
Now how should I write the code segment that u have given me, I mean which arguments should we pass to it?
thanks,
Pavan.
Suman
|
|
|
|
|
I would like to know how to use the method ArrayList::Sort to ssort an arraylist of point in order of their decreasing x cooordinates
plese contact me on gehanmustafa@hotmail.com
|
|
|
|
|
If you look at MSDN you will see that there is a overloaded version of the sort method that takes an IComparer object. See: ArrayList.Sort(IComparer)[^]
If you look at the documentation for the IComparer[^] interface you will see that you can create your own customised sorting routines.
Something like this might work *
class DescendingEastingComparer : IComparer
{
public int Compare(Point a, Point b)
{
return b.x - a.x;
}
}
Then when you call sort all you need do is:
MyArrayList.Sort(new DescendingEastingComparer());
* DISCLAIMER: I typed this directly into the browser, it is not tested and is not guaranteed to work
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Hi there,
I downloaded the source of
http://www.codeproject.com/netcf/Shopping.asp
If I want debug this app, a error message appears:
A project with an Output Type Class Library cannot start directly. I don't understand the solution written below. The main code runs in the frmMain.cs...
I set Output Type of "Shopping.Engine" to Windows Application, but I know that's not the right way. Can anybody help me plz to debug this app successfully ? Thx for help !
|
|
|
|
|
You should really ask these questions on the forum for the specific article. That is what they are there for.
Class Libraries are not something you can start, they only contain part of the functionality and are designed to be fitted in with something else.
Looking at the source code zip for the project there is a Shopping.GUI project that appears to contain the starting point for the application. You should use that.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
When using XML Documentation I have not foud a way to document the individual elements of an enum for example:
///
/// ActionType; RunRule, Action, Terminate
///
public enum ActionType {RunRule, Action, Terminate};
When I complile I get this message in my task list:
Missing XML comment for publicly visible type or member 'VRS.RulesEngine.Interfaces.ActionType.RunRule'
Missing XML comment for publicly visible type or member 'VRS.RulesEngine.Interfaces.ActionType.Action'
Missing XML comment for publicly visible type or member 'VRS.RulesEngine.Interfaces.ActionType.Terminate'
Any ideas on this????
Gary Paul
|
|
|
|
|
|
Well that's easy, once again I was looking for a more difficult solution!!!
Thanks for the help.
Gary
|
|
|
|
|
There is a property of the Windows Forms DataGrid called RowHeadersVisible. I set it to false, but the row headers never seem to disappear. Has anyone had any success getting row headers to disappear?
Thanks!
Mark
|
|
|
|
|
If you have used custom table and column styles, then you need to turn that property off on the DataGridTableStyle object.
|
|
|
|
|
Thanks Brian! That is exactly what it was.
Mark
|
|
|
|
|
hi,
I wrote an article for DataGridFormattings. That will help you out from this senario.
Sreejith Nair
|
|
|
|
|
Need Help Passing DataSet to another Windows form.
Connection is created on frmMain but need to access it in frm add to add a new record to database. ????
Can someone help me????????????
|
|
|
|
|
hi,
We can pass our dataset to any layer which our application have. Here your idea is to pass a dataset to one form to another. so what you can do is, write a parameterised contructor of you second form. And call this overloaded constructor when you want to create instance of the seconf form and want to access the dataset object.
I am sure that, this will serve your purpose.
Sreejith Nair
|
|
|
|
|
Need Help Passing DataSet to another Windows form.
Connection is created on frmMain but need to access it in frm add to add a new record to database. ????
Can someone help me????????????
|
|
|
|
|
Hello,
My latest effort involves allowing the user to copy a file out in the Windows shell (explorer, etc) and then be able to paste it into my application. So, they find a file "jinkies.jpg", press crtl-c, and then enter my app and click the edit menu, paste is available, and they paste, bringing the data into the program. What I would really like is to just get the filename(s) of the pasted files--then I can do whatever is necessary with the files (read them in, etc).
So there's really 2 questions:
1. How do I make my program aware of whether something is available for pasting on the clipboard, of the appropriate format (copied files)?
2. How do I bring this data into my program in an understandable format?
BTW: I am not working with images, that was just an example. I have already seen implemented the drag-and-dropping of files into a .NET app, and there you can get the filenames quite easily.
|
|
|
|
|
Well, by experimenting I was able to find out how to get data--the formats (!) for files copied at the shell include "Shell IDList Array", "FileDrop", and "FileName" among others. Still, is there some way I can monitor when data becomes available in the clipboard? Thanks a lot!
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
Recently I wanted to create a small little program that could sit on the desktop and not block the desktop wallpaper. There are two methods to accomplish this ( that I am aware of ).
1) create a solid color bmp as a background image and set the transparency key to match its color
2) specify the form's background color with a matching transparency key
Now my issues with both methods, but first it should be known that I have set the forms to have no border or title bar and have implemented code that allows me to click-and-hold anywhere ( with exceptions listed below ) on the form and move it. The data actually displayed on the form is just text and one rectangle, all drawn by me ( there are no controls on the form itself ).
1) I have two issues with this method, although it is what I'm prefering to use at the moment. The first seems to be the discrepancy between how the program is handled when the computer's Color Depth is 32bit or when it is less than 32bit ( 16bit ). When the color depth is 32bit then I am able to click on the entire area the form inhabits ( even that which is transparent ) and move it, but if the color depth is less than 32bit ( 16bit ) then only the drawn text or rectangle outline ( since it has no fill ) can be clicked to drag the program around. Clicking on the transparent areas just passes the click through the form to whatever is below ( even when I know the form has focus ). I'd like to be able, regardless of the desktop's color depth, to click anywhere within the form area and move the application.
The second issue I have with this method occurs when I take my executable and put it on another PC ( my PC is XP Pro, the other PC is XP Home.. Both SP2 ). The problem is similar, but a little different. When the 2nd PC's color depth is at 32bit, the transparency does not work. The green/lime ( that's the transparent color I'm using ) background shows. Needless to say this is not acceptable. When I change the color depth to less than 32bit ( 24bit this time ), the transparency actually works, but I come across the same issue of clicks on the transparent areas just passing through.
2) With this method I have not tried it on a 2nd PC yet ( I don't have it available where I am atm ). Its basically the same "issue" as mentioned above with color depth less than 32bit, except it does it with a color depth of 32bit and 16bit. Clicks on the transparent areas just pass right through. I'm tempted to just go with this method and possibly make one area on the form that is meant to be used to drag it around ( similar to the idea of the box that appears to move tables in MS Word ), but I'm hoping there's a solution I'm unaware of before I do that.
Anyways, all of this brings up some interesting questions.
-What does color depth have to do with transparency handling?
-Does the version of XP ( Home or Pro ) handle transparency differently?
Probably some more questions also.
Not sure if it matters, but I'm doing all of this in C#.
So any ideas to get pass any of these issues?
Thanks in advance.
|
|
|
|
|
I found this code somewhere and changed it for use in my project. It doesn't work and I can't find anywhere or anyobe who can tell me how to work with a datagrid.
Is it a big secret? Is no one allowed to know how to work with this bloody thing?
This is the code:
partial class frmWords : MNLForm
{
OleDbConnection myConn;
OleDbDataAdapter myAdapter;
DataSet ds;
OleDbParameter workParam = null;
string myQuery = "select ID, Word from Thai";
public frmWords()
{
InitializeComponent();
ConnectToData(); // establish database connection and create DataSet
grdThaiWords.DataSource = ds.Tables[0].DefaultView;
//myGrid.SetDataBinding(ds, "CardTest");
DataTable t = ds.Tables[0];
t.RowChanged += new DataRowChangeEventHandler(Row_Changed);
}
private void Words_Load(object sender, EventArgs e)
{
}
public void ConnectToData()
{
ds = new DataSet();
myConn = new OleDbConnection(System.Configuration.ConfigurationSettings.ConnectionStrings["Dictionary"].ConnectionString);
myAdapter = new OleDbDataAdapter();
myAdapter.SelectCommand = new OleDbCommand(myQuery, myConn);
myAdapter.Fill(ds, "Thai");
insertCommand();
updateCommand();
}
public void updateCommand()
{
string updateQuery = "Update Thai Set Word = @Word WHERE ID = @ID";
myAdapter.UpdateCommand = new OleDbCommand(updateQuery, myConn);
workParam = myAdapter.UpdateCommand.Parameters.Add("@Word", OleDbType.Char);
workParam.SourceColumn = "Word";
workParam.SourceVersion = DataRowVersion.Current;
}
private void Row_Changed(object ob, DataRowChangeEventArgs e)
{
DataTable t = (DataTable)ob;
Console.WriteLine("RowChanged " + e.Action.ToString() + "\t" + e.Row.ItemArray[0]);
}
public void insertCommand()
{
string insertQuery = "Insert into Thai VALUES (@Word)";
myAdapter.InsertCommand = new OleDbCommand(insertQuery, myConn);
workParam = myAdapter.InsertCommand.Parameters.Add("@Word", OleDbType.Char);
workParam.SourceColumn = "Word";
workParam.SourceVersion = DataRowVersion.Current;
}
public void UpdateValue()
{
try
{
myAdapter.Update(ds, "CardTest");
Console.Write("Updating DataSet succeeded!");
}
catch (Exception e)
{
Console.Write(e.ToString());
}
}
}
I just want a datagrid that does a update when something is changed and inserts when there is a new row.
Thanks
|
|
|
|
|
I am currently working with the Windows Form DataGrid and i am finding the lack of information on it very frustrating. The link below provides a good series of articles on its use.
www.codeproject.com/csharp/PracticalGuideDataGrids1.asp
What I don't understand is why Microsoft relies on the developers to document THEIR controls.
Mark
|
|
|
|