You Tube
Saturday 3 June 2017
Sunday 19 March 2017
make variable available to all windows form c#
Go to Project -> Add Class. Name your class Variables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
namespace MY_namespace
{
class my_global_Variables
{
public static string var1 = "Something";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
namespace MY_namespace
{
class my_global_Variables
{
public static string var1 = "Something";
}
}
Create a setup project in visual studio ...
Adding Project a Primary Output ...
Add a setup project in your project solution by
Right Click on Solution -> Add -> New project
Add New Project window opens. Select Setup Project by
Other Project Types -> Setup and Deployment -> Visual Studio Installer
Give some name to your setup project and click OK
Setup Project gets added into your project solution.
Right click on your setup project
Go to Add option and then Project Output
Select Primary Output of in the list box and select your application in the top combo box. Now click OK.
Again right click on your setup project and Go to View option and then Custom Actions
Now Custom Actions window gets opened. Right click the Custom Actions and then Add Custom Action…
A window opens, now you have to double click Application Folder option. Doing this, you get to see Primary output from “Your Project”. Select that option and click OK
You would see that primary output of your project gets added in Install, Commit, Rollback and Uninstall option.
Make sure that your setup project is got added into your project solution.
Choose What to Install or Download before installing ...
Choose Setup Soltion and then prerequisites ...
then choose what to install ...
Monday 13 March 2017
Get Column Names and Column count number in MSSQL ?
For Name Try this :
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'my_table'
For Column count Try this :
SELECT Count(*) FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'my_table'
Sunday 12 March 2017
Change MDI Parent Back Color
Copy Paste this ...
MdiClient myMDI; foreach (Control ctl in this.Controls) { try {
myMDI
= (MdiClient) ctl;
myMDI
.BackColor = this.BackColor; } catch (InvalidCastException exc) { // your code ... } }
Monday 27 February 2017
Wednesday 22 February 2017
Way of tracking previous page asp.net ?
Try This ...
static string prev = String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if( !IsPostBack )
{
prev = Request.UrlReferrer.ToString();
}
}
protected void btn_previous(object sender, EventArgs e)
{
Response.Redirect(prev);
}
Tuesday 21 February 2017
how to give height that fits the page css ?
Try this:
style="height: 100vh;"
or
html, body {height: 100%;}
or
body
{
padding:0px;
margin:0px;
width:100%;
height:100%;
}
Monday 6 February 2017
how to stop last entry suggestion textbox in asp.net ?
try this:
autocomplete="off"
example:
<asp:TextBox ID="TextBox1" runat="server" autocomplete="off"></asp:TextBox>
Sunday 5 February 2017
How to add a column using query MS SQL ?
ALTER TABLE my_tbl
ADD my_col varchar(50)
to delete try this:
ALTER TABLE my_tbl DROP COLUMN my_col
to delete try this:
ALTER TABLE my_tbl DROP COLUMN my_col
Friday 3 February 2017
textbox accept only numbers in javascript ?
<SCRIPT language=Javascript>
function allow_num(num) {
var charCode = (num.which) ? num.which : num.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</SCRIPT>
call this function:
<asp:TextBox ID="txt_num" onkeypress="return
allow_num
(event)" CssClass="txt" runat="server"></asp:TextBox>
<input id="Text1"
onkeypress="return
type="text" />
allow_num
(event)"
Enable row number in visual studio for HTML and Back End codes?
On the menu bar,
Click Tools,
Then Options (in bottom).
Expand the Text Editor node,
Then the languages you are using,
EG: C#, HTML
You are then done here...
Click Tools,
Then Options (in bottom).
Expand the Text Editor node,
Then the languages you are using,
EG: C#, HTML
You are then done here...
Thursday 5 January 2017
How to clear all text Boxes in c#?
Put this function in your source code and call from somewhere it's needed.
private void clear_txt_boxes()
{
Action<Control.ControlCollection> func = null;
func = (controls) =>
{
foreach (Control control in controls)
if (control is TextBox)
(control as TextBox).Clear();
else
func(control.Controls);
};
func(Controls);
}
private void clear_txt_boxes()
{
Action<Control.ControlCollection> func = null;
func = (controls) =>
{
foreach (Control control in controls)
if (control is TextBox)
(control as TextBox).Clear();
else
func(control.Controls);
};
func(Controls);
}
Get data from two different tables in MS SQL
Try this...
Select a.id, a.name,b.adrs from table1 a, table2 b
Select a.id, a.name,b.adrs from table1 a, table2 b
How to clear the text of all textBoxes in the form?
This will work fine...
private void ClearTextBoxes()
{
Action<Control.ControlCollection> func = null;
func = (controls) =>
{
foreach (Control control in controls)
if (control is TextBox)
(control as TextBox).Clear();
else
func(control.Controls);
};
func(Controls);
}
Subscribe to:
Posts (Atom)