|
Before you get insulting, you should really check what you posted. In your post you state
"My question is how can we save button click event state in database that whether it is clicked or not means if user click the button then automatically it will saved as yes in database else
no. I am using SQL Serve 2008 r2
Please help me out
Thanks"
Where, in that, does it say anything about Windows Forms?
|
|
|
|
|
AMRITESH ASTHANA wrote: Human Stupidity Is the FATHER of INNOVATION It is a quote!
AMRITESH ASTHANA wrote: I clearly mention that this application is in windows Form Where!
If you are using windows forms then trap the click event (double click on the button in the designer to create the stub).
Check the value of the control and write the result to the database.
However your design is stinks, what happens if the user never clicks the button, what happens if the user clicks the button 15 times.
And yes I am trying to make it complex, you need to think through what the user can do. It seems a checkbox would be a better control for this requirement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
can some body tell me about the logic for creating my own forum using c# in asp.net?
|
|
|
|
|
Where are you stuck? Clearly you'll need a database to store your data but then the layout and how it works is up to you.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I'd recommend downloading an open-source forum-application for ASP.NET, and taking a look at the source-code.
That text is the programming logic. If you want to create your own you should study C#. If you want to be up and running quickly and mucking with databases fast, I'd recommend the tutorials from w3schools.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
For forum source you could try
DotNetNuke http:
http:
http:
A feature limited free version of Community Server, the same software that this Forum runs on is available here - http:
http:
http:
http:
http:
Sankarsan Parida
|
|
|
|
|
I am developing application in c# windows form . I have a need to put button in cell of datagridview this button perform an action of sending mail. What I have to do is after clicking this column button it must have to be disabled and it must to be disabled without using check box just after clicking.
Please help me i struck over here i am unable to make this happen.
--------------------------code--------------------------------
namespace WindowsFormsApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 3)
{
MessageBox.Show(" Row & column");
dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Gray; // for making the row highlighted
}
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.ColumnCount = 3;
dataGridView1.Columns[0].Name = "Product ID";
dataGridView1.Columns[1].Name = "Product Name";
dataGridView1.Columns[2].Name = "Product Price";
string[] row = new string[] { "1", "Product 1", "1000" };
dataGridView1.Rows.Add(row);
row = new string[] { "1", "Product 2", "2000" };
dataGridView1.Rows.Add(row);
row = new string[] { "3", "Product 3", "3000" };
dataGridView1.Rows.Add(row);
row = new string[] { "4", "Product 4", "4000" };
dataGridView1.Rows.Add(row);
DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
dataGridView1.Columns.Add(btn);
btn.HeaderText = "Click Data";
btn.Text = "Click Here";
btn.Name = "btn";
btn.UseColumnTextForButtonValue = true
}
}
}
Thanks
|
|
|
|
|
|
Mr. Eddy You are disgusting and your Code is just like you means disgusting just make "garbage collector" of your code.
|
|
|
|
|
You are welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hi every body
I have an app written by C# that exchange the words by keyboard mistake between two language(En & Fa, and now i want to add it to Microsoft office word as an Add-in but i don't know what to do!
can anyone help me about it?
thanks in advance
best regards
Nashalj
|
|
|
|
|
You can start by searching CodeProject for "Microsoft Word Add-In," and similar search keys, which will lead you to resources like:
Writing a Word Add-In - Part 0 by David Thielen
Article 12 Jan 2005 license: N/A
Learn to write an add-in in C# that does everything a regular C# program does.
Writing a Word Add-in - Part I by David Thielen
An explanation of what you need to know to write a Word add-in in C#.
Article 13 Jan 2005 license: N/A
« There is only one difference between a madman and me. The madman thinks he is sane. I know I am mad. » Salvador Dali
|
|
|
|
|
here i have attached my full code. i wrote SqlDependency related code in windows service which will fire mail when any data change found in a specific table in database. when i start my service then it is working fine. suppose when i start my service and after that when i change data in table then i saw mail is coming but from the next day when i change data in table then i am not getting any mail. some how SqlDependency is getting freeze or stuck but i am not being able to catch where is the problem lies in the code.
so please see my windows service code and guide me where i am making the mistake for which SqlDependency is not working every time properly.
public partial class PartIndexer : ServiceBase
{
static string connectionString = "MyConnection String;Pooling=true;Connect Timeout=20;";
SqlDependency dep;
public PartIndexer()
{
InitializeComponent();
}
#region OnStart
protected override void OnStart(string[] args)
{
System.Data.SqlClient.SqlDependency.Stop(connectionString);
System.Data.SqlClient.SqlDependency.Start(connectionString);
RegisterNotification();
MailNotify("STARTED");
}
#endregion
#region RegisterNotification
private void RegisterNotification()
{
string tmpdata = "";
try
{
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT ActivityDate FROM [bba-reman].ContentChangeLog";
dep = new SqlDependency(cmd);
dep.OnChange += new OnChangeEventHandler(OnDataChange);
SqlDataReader dr = cmd.ExecuteReader();
{
while (dr.Read())
{
if (dr[0] != DBNull.Value)
{
tmpdata = dr[0].ToString();
}
}
}
dr.Dispose();
cmd.Dispose();
}
}
finally
{
}
}
#endregion
#region OnDataChange
void OnDataChange(object sender, SqlNotificationEventArgs e)
{
SqlDependency dep = sender as SqlDependency;
dep.OnChange -= new OnChangeEventHandler(OnDataChange);
SendMailNotification();
RegisterNotification();
}
#endregion
#region StartIndex
void SendMailNotification()
{
}
#endregion
#region MailNotify
void MailNotify(string strStatus)
{
if (strStatus == "STARTED")
{
var template = new MailTemplate()
.WithBody("HI,<br><br>Part Indexer Started Date " + DateTime.Now.ToLongDateString())
.WithSubject("Part Indexer Started")
.WithSender("xxxxx")
.WithRecepient("xxxx")
.Send();
}
else if (strStatus == "STOPPED")
{
var template = new MailTemplate()
.WithBody("HI,<br><br>Part Indexer stopped Date " + DateTime.Now.ToLongDateString())
.WithSubject("Part Indexer Stopped")
.WithSender("xxx")
.WithRecepient("xxx")
.Send();
}
}
#endregion
#region OnStop
protected override void OnStop()
{
System.Data.SqlClient.SqlDependency.Stop(connectionString);
MailNotify("STOPPED");
}
#endregion
}
tbhattacharjee
|
|
|
|
|
hi every one
i want add a one record to sql from grid janus and one cell from a editbox control
with binding navigator but can not add and message show column code can not null.
my source code:
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
codemax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codemax = codemax + 1;
editBox1.Text = codemax.ToString();
((DataRowView)fatemeBindingSource1.Current).Row["code"] = codemax;
}
and savebinding:
private void save_Click(object sender, EventArgs e)
{
int g, b;
g=Convert.ToInt32(gridEX1.CurrentRow.Cells["code_b"].Value);
b=Convert.ToInt32(gridEX1.CurrentRow.Cells["name"].Value) ;
((DataRowView)fatemeBindingSource1.Current).Row["code_b"] = g;
((DataRowView)fatemeBindingSource1.Current).Row["name"] = b;
this.Validate();
fatemeBindingSource1.EndEdit();
fatemeTableAdapter.Update(this.baziDataSet1.fateme);
}
i dont how get value from new row in grid please help me
best a regards
modified 7-Oct-14 8:34am.
|
|
|
|
|
i am tierd please help me.i am trying for find reply question a long time.i am tierd.
i am set allowaddnew equal true.it might read from new record in grid that is bound and editbox that is unbound and add to data base and add to grid that show error column code can not be null that column code is editbox control and i was delete from column grid. or i should all coulmn from table in out gird and read from there and add to grid and database .i am mixed up
best a regards
modified 6-Oct-14 3:12am.
|
|
|
|
|
|
my god i am tierd please help me.
|
|
|
|
|
i dont english as well .from all friend want to guide me for solve my problem.
i am very very hope that this site firend my problem resolved...
best regards
modified 6-Oct-14 13:01pm.
|
|
|
|
|
i have one table with 3 column=code,name,code_b
and in form i have a bindingnavigator that addnewitem=none and bindingsource=fatemebinding
and in gridex datasourc=fatemebinding and in gridex allownew=addnew and rowheader=true and headercontent =rowposition and in griddesignert click in createroottable and retrive table and then column table ceated and then code envirement
newiconbinding:
[php]
try
{
fatemeBindingSource.AddNew();
codmax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codmax = codmax + 1;
gridEX1.CurrentRow.Cells["code"].Value = codmax;
((DataRowView)fatemeBindingSource.Current).Row["code"] = codmax;
}
catch
{
MessageBox.Show("لطفا اطلاعات را وارد کنید");
}
[/php]
and save iconbindingnavator:
[php]
private void toolStripButton1_Click(object sender, EventArgs e)
{
fatemeBindingSource.EndEdit();
fatemeTableAdapter.Update(this.baziDataSet1.fateme);
}
[/php]
but in run name and code_b value to be null
how to asign data column
please help me
|
|
|
|
|
Hallo, this is my first post but i am stuck on a question.
* Write a program that prompt the user for a single integer.
* The program will display if the number is a multiple of
* 2 or 3 or both or neither 2 nor 3. Use the modulus (%) to check
* for divisibility
*
* You must use an if statement for this solution
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Question3
{
class Program
{
static void Main(string[] args)
{
int integer;
Console.Write("Enter an integer: ");
integer = Convert.ToInt32(Console.ReadLine());
if(integer == integer / 2 && integer == integer / 3)
{
Console.Write(integer + " is a multiple of both 2 and 3.");
}
if (integer == integer / 2)
{
Console.Write(integer + " is a multiple of 2.");
}
else if (integer == integer / 3)
{
Console.Write(integer + "is a multiple of 3");
}
if (integer != integer / 2 && integer != integer / 3)
{
Console.Write(integer + " is not a multiple of either 2 or 3");
}
}
}
}
It looks un-alligned but I think that is because when I paste it here it didn't have enough width room.
I do not know what I did wrong with the if, else if, and else part.
When I try to run it, no matter what integer i put it always shows up being neither a multiple of 2 and 3.
|
|
|
|
|
You are not using the modulo (%) operator [^].
Example:
int testInt = 23;
bool isMultipleOf2 = testInt % 2 == 0; // false
testInt = 21;
bool isMultipleOf3 = testInt % 3 == 0; // true
Try and think carefully about the logic you need to apply in your evaluations; your goal should be to have the minimum number of if/else statements, and to avoid repeating evaluating the integer argument more than once for any given condition.
A good thing to do while developing is to set a break-point at the start of your routine, and single-step through the code (you can use F11 in Visual Studio): examine the values of the variables at each line of code, and watch the flow-of-control in the code.
« There is only one difference between a madman and me. The madman thinks he is sane. I know I am mad. » Salvador Dali
modified 5-Oct-14 16:19pm.
|
|
|
|
|
if((integer % 2 == 0) && (integer % 3 == 0))
{
Console.Write(integer + " is a multiple of both 2 and 3.");
}
else if (integer % 2 == 0)
{
Console.Write(integer + " is a multiple of 2.");
}
else if (integer % 3 == 0)
{
Console.Write(integer + "is a multiple of 3");
}
else
{
Console.Write(integer + " is not a multiple of either 2 or 3");
}
Please refer the following useful materials,
http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx[^]
http://msdn.microsoft.com/en-AU/library/ms173145.aspx[^]
It's very important to learn the basics of the language. Spend more time in read and learn.
|
|
|
|
|
This looks suspiciously like a homework type question
|
|
|
|
|
|
Hello Everyone, Can someone please help me out I am getting
NullReferenceException error and I don't understand why.
Error: Object reference not set to an instance of an object.
at WindowHome.xaml.cs:line 283
Code:
public void GetTransactionData()
{
DateTime today = DateTime.Now.Date;
List<Transaction> newTransactionList = DataManager.GetTransaction();
List<Transaction> TransactionDataGridData = new List<Transaction>();
var CurrentMonthTransaction = (from item in newTransactionList
where ((int)item.Date.Month == today.Month)
where ((int)item.Date.Year == today.Year)
select item);
try
{
foreach (Transaction item in CurrentMonthTransaction)
{
TransactionDataGridData.Add(item);
}
if (TransactionDataGridData.Count >= 1)
{
dgvTransactionList.ItemsSource = TransactionDataGridData.ToList();
decimal transactionTotal = (from item in TransactionDataGridData
select Convert.ToInt32(item.Amount)).Sum();
txtTotalTransaction.Content = "Total: " + string.Format("{0:C}", transactionTotal);
}
}
catch (Exception error)
{
MessageBox.Show(error.ToString());
}
}
I have underlined where I get the error
Thanks!
Saeed
modified 4-Oct-14 13:39pm.
|
|
|
|