Prerequisites button disabled – MSI installer

Prerequisities in Visual Studio Projects In Configuration at the top of the dialog, did you try to select either Release or Debug? That should enable the Prerequisites… button. Unecessary, outdated prerequisites? One pet-peeve of mine: is it really necessary to include the .NET runtime as a prerequisite when most users have it installed by their … Read more

Download a file through the WebBrowser control

Add a SaveFileDialog control to your form, then add the following code on your WebBrowser’s Navigating event: private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Segments[e.Url.Segments.Length – 1].EndsWith(“.pdf”)) { e.Cancel = true; string filepath = null; saveFileDialog1.FileName = e.Url.Segments[e.Url.Segments.Length – 1]; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { filepath = saveFileDialog1.FileName; WebClient client = new WebClient(); client.DownloadFileCompleted … Read more

How do I programmatically scroll a winforms datagridview control?

Well, since this is a datagridview… Sorry for the ‘winforms’ in the question… but I could just do this.. scrolling up or down one row. Scroll up: this.FirstDisplayedScrollingRowIndex = this.FirstDisplayedScrollingRowIndex – 1 Scroll Down: this.FirstDisplayedScrollingRowIndex = this.FirstDisplayedScrollingRowIndex + 1; You’ve gotta make sure to check that the numbers don’t go out of bounds though.

How to store passwords in Winforms application?

The sanctified method is to use CryptoAPI and the Data Protection APIs. To encrypt, use something like this (C++): DATA_BLOB blobIn, blobOut; blobIn.pbData=(BYTE*)data; blobIn.cbData=wcslen(data)*sizeof(WCHAR); CryptProtectData(&blobIn, description, NULL, NULL, NULL, CRYPTPROTECT_LOCAL_MACHINE | CRYPTPROTECT_UI_FORBIDDEN, &blobOut); _encrypted=blobOut.pbData; _length=blobOut.cbData; Decryption is the opposite: DATA_BLOB blobIn, blobOut; blobIn.pbData=const_cast<BYTE*>(data); blobIn.cbData=length; CryptUnprotectData(&blobIn, NULL, NULL, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &blobOut); std::wstring _decrypted; _decrypted.assign((LPCWSTR)blobOut.pbData,(LPCWSTR)blobOut.pbData+blobOut.cbData/sizeof(WCHAR)); If … Read more

MVVM for winforms [duplicate]

I think that there are two answers here… really just one answer to “Should I” and one answer to “Could I”. As far as “Could I”, it is certainly possible. MVVM really just relies on a view that can bind to a view model. Since WinForms supports binding, this certainly is possible. You may need … Read more