Showing posts with label vbproj. Show all posts
Showing posts with label vbproj. Show all posts

Monday, January 1, 2018

Asp.Net Identity SQLite Provider on a Web Forms project

  Mostly, the tutorial or sample I found from googling was for MVC and C#. So I decided to install the Asp.Net.Identity.SQLite by following the guide from MVC then modify it to work for Web Forms then convert it to VB.

I'm using Visual Studio 2017.

Create a new ASP.NET Web Forms Site project, targeting .Net Framework 4.7.1


Tuesday, May 24, 2016

Run Program as Administrator programmatically

I need to run a program as Administrator programmatically.

Fortunately googling this was so easy. Found this one:
Run Program As Administrator in vb.net


Open the Project Properties then click on View Windows Setting button. It will open the app.manifest file.

Using Squirrel to replace ClickOnce

Installing Squirrel

While I was searching for a way to make ClickOnce deploy easier after all hardship about certificate and identity errors, I bump into Squirrel.Windows. Thanks to Travis's comment in this question: Deploy a ClickOnce application without signing. Even though no one answer that was Marked ans Answer (yet at the time), the comments really help to give me an idea about some alternatives.

I create a new project that target a .Net Framework 3.5 and start searching for it in the Manage Nuget Packages for Solution.Current latest stable version is 1.4.0. I install it right away.


Create a new Nuget Package for my Visual Studio Application

To create a new Nuget Package, I must install the Nuget Package Explorer. If uses Internet Explorer, it will run immediately to install if click the Download button.

This is when I run it:



1. I just have to create a new package (Ctrl+N).

Saturday, May 21, 2016

Positioning a control on the center of the form

Sometimes when I created a resizable or maximized form, I want to position my control on the center of my form depending on the screen resolution.

I use this code:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    MyBase.OnLoad(e)
    Dim btn = New Button()
    Controls.Add(btn)
    btn.Location = New Point((ClientSize.Width - btn.Width) \ 2, _
                             (ClientSize.Height - btn.Height) \ 2)
End Sub
Reference: Centering (perfectly) dynamically created buttons on form?

Monday, May 16, 2016

Problem with "Application identity is not set". (solved?)

Today I got a problem when I test my application. I commonly build my application then run it from the "debug" or "release" folder in my VirtualBox.

After some googling, I learn that the cause of the problem comes from this code:

lblVersion.text = Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString
Reference: How to show program version in your form?

Sunday, May 15, 2016

Include the project2.exe.config info in a reference executable in .NET?

I have a problem in a referenced project where the project2.exe.config file for a referenced project in not included in the project. Every time I must copy the project2.exe.config file into my project manually to make it works.

Tried googling and found this:

I have one executable project, let's say A, which is launching another executable project Bin the run. In order to have a B.exe in A's current working folder, I add B as A's reference so that after the compilation a B.exe will be copied into A's folder. However, I noticed the configuration that I make for B is not copied or generated in A's folder (there is no B.exe.config file in A's folder, only B.exe), and hence the stuff such as tracing for B is not configured correctly.
I can of course copy the B.exe.config manually to A's folder, but I bet there is some automatic way to do that. Could anybody help me?

Reference: How to include the App.config info in a reference executable in .NET?