Showing posts with label WinForm. Show all posts
Showing posts with label WinForm. Show all posts

Monday, August 05, 2013

Migration from VS 2005 to VS 2012: Include Prerequisites with a ClickOnce Application

Another issue I faced while migrating from VS 2005 to VS 2012 was How to Include Prerequisites with a ClickOnce Application.

Click here for the solution

Wednesday, July 11, 2012

Reading a Lotus Notes Mail Box



You need the Lotus Domino Objects to be added into your application. Refer: http://www.ibm.com/developerworks/lotus/library/domino-msnet/

You need to know the Path of your Lotus Notes Mail-box:

 
Domino.NotesSession s = new Domino.NotesSession();
            Domino.NotesDatabase db;
            Domino.NotesView vw;
            Domino.NotesDocument doc;

            try
            {
                //Leave blank Password, then It will prompt for Password, It basically authenticates with the *.id file
                s.Initialize("mypassword");

                //If Server is blank, which Local otherwise specify the Server
                //Place the Mailbox path Next
                db = s.GetDatabase("", @"C:\Documents and Settings\me\Local Settings\Application Data\Lotus\Notes\Data\mail\me\mymailbox.nsf", false);
                if (db != null)
                {
                    //Inbox is special/hidden folder
                    vw = db.GetView("($Inbox)");
                    doc = vw.GetFirstDocument();

                    while (doc != null)
                    {
                        String Subject = ((object[])doc.GetItemValue("Subject"))[0] as String;
                        String From = ((object[])doc.GetItemValue("From"))[0] as String;

                        textBox1.Text += Subject;
                        textBox1.Text += From;
                        doc = vw.GetNextDocument(doc);
                    }
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
 
 
Additional Resources:









MODI Viewer

It appears that MODI (Microsoft Office Document and Imaging) Viewer control does not release the previous file if a new file to be swapped; I had facing the same trouble when I tried to open a new ".tif" file after the previous was viewed. Note here is that I use the same file name for view and delete it and finally if a new file is been given I rename it back for any new to the same file name which I had deleted.

Check how I overcame it here

An article I got while googling on the same topic can be seen here

Good Luck!

Thursday, July 21, 2011

Default Values via BindingSource's AddingNew Event

I new that BindingSource's AddingNew event can handle all default value assignment, but was so frustrated that I could not find any articles/tutorials which guided me on how to use it. Although MSDN had description, but it did not have samples on how to use it. However, with few long hour searches I came to a source which enlighted me on how to use this event.

A sample code looks like this:
 
private void branchBindingSource_AddingNew(object sender, AddingNewEventArgs e)
{

//// Get data table view 
DataView dataTableView = branchBindingSource.List as DataView;


//// Create row from view
DataRowView rowView = dataTableView.AddNew();


rowView["BranchID"] = -1;
rowView["BranchCode"] = "001";
rowView["BranchDescription"] = "002";

//// Set New row
e.NewObject = rowView;

branchBindingSource.MoveLast(); 

}