15,900,616 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 13854008 (Top 34 by date)
Member 13854008
19-Nov-19 1:43am
View
being generated from mvc model
Member 13854008
14-Jun-19 6:18am
View
actually our question is how to pass this value to view page in javascript function
Member 13854008
12-Sep-18 2:20am
View
USE TargetDatabase
GO
INSERT INTO dbo.TargetTable(field1, field2, field3)
SELECT field1, field2, field3
FROM SourceDatabase.dbo.SourceTable
WHERE (some condition)
Member 13854008
7-Sep-18 2:41am
View
tanku very much sir ,i got it.
Member 13854008
7-Sep-18 1:22am
View
sir , data means records that enter in table. actually i want to transfer the data from one table(db1) to another existing table in db2
Member 13854008
6-Sep-18 22:55pm
View
No sir that's why some errors shown there.
Member 13854008
6-Sep-18 22:54pm
View
sir, I want to get the datas also that enter inthe table not only the fields.
Member 13854008
6-Sep-18 22:52pm
View
No sir, that's why some error shown there
Member 13854008
31-Aug-18 5:06am
View
ok sir I got it and thank you very much for your consideration.
Member 13854008
31-Aug-18 1:18am
View
private void button2_Click(object sender, EventArgs e)
{
int year = int.Parse(comboBox1.Text);
dateTimePicker1.MinDate = DateTimePicker.MinDateTime;
dateTimePicker1.MaxDate = new DateTime(year + 1, 03, 31);
dateTimePicker1.MinDate = new DateTime(year, 04, 01);
}
--------------------------------------------------------------------
Here I used //int year = int.Parse(comboBox1.Text);//
this code for select the year.But this year select in combobox at running time.
but user want to select year from datetimepicker itself at running time.
ex:if user select 2014 datetimepicker, it shows from 2014 april to 2015 march .
then if user select another(2016) year from datetimepicker ,it shows 2016 april to 2017 march, here the month only restrict from april to march
Member 13854008
29-Aug-18 8:00am
View
ok sir, I changed the value changed handler, then how could that limit or range given in that code,or how could currently select different years
Member 13854008
29-Aug-18 7:42am
View
sir, all years means not select all years at a time, but when we select one year by mistakened ,we can select another year there ,how it can possible.
sir please give hint too.
Member 13854008
29-Aug-18 7:03am
View
sir ,then how could that control given in the code.
dateTimePicker1.MinDate = DateTimePicker.MinDateTime;
dateTimePicker1.MaxDate = new DateTime(year+1,03,31);
dateTimePicker1.MinDate = new DateTime(year,04, 01);
actually in this code year is given as year no other other value given, so we can assign all years in a variable(year)( otherwise year seems red error). so how could all years assign in that variable (year)
Member 13854008
29-Aug-18 6:14am
View
thanku sir that error has solved ,but how this year assign here
int year = dateTimePicker1.Value.Year; //this code only select system year.
I want select all years years here. plz help thats too sir.
Member 13854008
29-Aug-18 4:59am
View
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
int year = dateTimePicker1.Value.Year;
dateTimePicker1.MinDate = new DateTime(year,04, 01);
dateTimePicker1.MaxDate = new DateTime(year+1,03,31);
}
this is my code.if i select other year from datetimepicker,its get an error as(Value of '17/04/01 12:00:00 AM' is not valid for 'MinDate'. 'MinDate' must be less than MaxDate and it only select system year.)
Member 13854008
29-Aug-18 4:31am
View
actually here the year came only the current year, no other year can be selected.
Member 13854008
23-Aug-18 6:32am
View
it's c# (windows application)
Member 13854008
20-Aug-18 6:22am
View
please any one help...plz
Member 13854008
3-Aug-18 3:15am
View
thanku sir..i got it
i have one doubt too sir. The word "TOTAL" also want at end of row of cell 1
i have tried below code
for (int i = 1; i < dt.Columns.Count; i++)
{
dataGridView1[i, 1].Value = "TOTAL";
}
it didn't gave crct answer. When i had work this , the full cell 1 written as total.
but i want total came at the last row of cell 1
Member 13854008
30-Jul-18 0:51am
View
tankuu very much sir...i got it with ur help
Member 13854008
30-Jul-18 0:22am
View
if we add another table month ,then how the each month enter there and link with other tables
Member 13854008
30-Jun-18 1:24am
View
tanku this link helps me... but i have one doubt too
i select the month from first table ,so if first table is empty the month didn't came there intead of that zero can fill there. so what to do to get the month also there
Member 13854008
26-Jun-18 6:15am
View
ok...then how to join 5 tables together and how to see in datagrid when one table only filled
Member 13854008
11-Jun-18 7:00am
View
kk ,i got it ...got the ans
Member 13854008
11-Jun-18 3:19am
View
it link also not good reference to me....
Member 13854008
11-Jun-18 1:47am
View
yes ,this is needed but how it can check and add it by one button click
Member 13854008
11-Jun-18 1:12am
View
thats ok ,but how we can sum the datagrid cell values except the empty cells.OR we can fill zero in empty cells as programitically.plz help....
Member 13854008
10-Jun-18 13:02pm
View
foreach (DataGridViewRow row in dataGridView1.Rows)
{
int total = 0;
for (int index = 2; index < row.Cells.Count; index++)
{
total += Convert.ToInt32(row.Cells[index].Value);
row.Cells[0].Value = total;
}
actually this code gives the total of the cell value but if any cells are empty, its cannot give the total but shows error as"(Object cannot be cast from DBNull to other types)"
Member 13854008
10-Jun-18 12:37pm
View
Deleted
sry sry....i am very sry ...i am told becoz of my tension .sry sir
Member 13854008
10-Jun-18 12:27pm
View
i can't get total when any cell in the row is empty. So how could get the total of the like this
p p p tot
.................
2 ... 10 12
Member 13854008
10-Jun-18 12:24pm
View
not the same ,its have one problem ..if any of the cell in that row is empty then its seems error, its can't give the total....so my question is how to add cell values when one or more cells are empty...plz reply fast ..
Member 13854008
4-Jun-18 0:54am
View
sir ,this problem was solved.thanku very much for your reply sir ..your code was correct, error get bcoz of my mistake ur code was right one tanku very much
Member 13854008
4-Jun-18 0:44am
View
Deleted
my code page is.........
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
namespace WindowsFormsdupli
{
public partial class Form2 : Form
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["myproject"].ToString());
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("SELECT emonth as 'Month',expence as 'Expence',specialoffrexp as 'Special offer expence' FROM entryexp AS e INNER JOIN entryspecialexp AS o ON e.emonth = o.semonth and e.year=o.year where e.date between '" + dateTimePicker1.Value.ToString("yyyy/MM/dd") + "' and '" + dateTimePicker2.Value.ToString("yyyy/MM/dd") + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
dataGridView1.DataSource = dt;
}
else
{
MessageBox.Show("no record");
}
con.Close();
}
//this also gives total when the cell is validating
private void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
string valueA = row.Cells[2].Value.ToString();
string valueB = row.Cells[3].Value.ToString();
int result;
if (Int32.TryParse(valueA, out result) && Int32.TryParse(valueB, out
result))
{
row.Cells[0].Value = int.Parse(valueA) + int.Parse(valueB);
}
}
}
//output of above code..its not give total, only give month,expence,speclexpence(these three columns are inner join of three datatables and the column total is add in gridview. There is no table for total in database , i want
this total came from sum of griview column.i want this sum by one button click)
Month expence speclexpence total
January 200 100 ?
february 100 100 ?
//and your code again make an error as "Input string was not in a correct format ".
this error in code line "total += Convert.ToInt32(row.Cells[index].Value);"
In this datagrid rows only incremented, columns can't(only 3 columns)
Member 13854008
2-Jun-18 4:27am
View
This code is not working,its shows an error(Input string was not in a correct format).
could u plz send me the code for me,its very urgent.....by one buttonclick i need full rows total at column "total"
Show More