15,917,610 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 nicola_melc (Top 20 by date)
nicola_melc
1-Dec-14 10:40am
View
But, you used a DataGridView?
nicola_melc
1-Dec-14 10:21am
View
I've solved using a SqlDataReader.
This is my code:
string SQLquery = "SELECT * FROM dbo.ripRiparazioni";
SqlDataAdapter da = new SqlDataAdapter(SQLquery, connessione);
DataSet ds = new DataSet();
da.Fill(ds);
dgvListaRiparazioni.DataSource = ds.Tables[0];
SqlCommand command = new SqlCommand(SQLquery, connessione);
SqlDataReader reader = command.ExecuteReader();
foreach (DataGridViewRow righe in dgvListaRiparazioni.Rows)
{
if (reader.HasRows)
{
while (reader.Read())
{
DateTime date = (DateTime)righe.Cells["Data"].Value;
if (date.Date >= DateTime.Now.AddDays(-3).Date)
{
righe.DefaultCellStyle.BackColor = Color.White;
}
else
{
righe.DefaultCellStyle.BackColor = Color.Yellow;
}
}
}
}
Hope it is helpful.
nicola_melc
1-Dec-14 8:37am
View
If you put your code into try-catch you can show the error. Like this:
try
{
}
catch (Exception a)
{
MessageBox.Show(a.Message.ToString());
}
At the moment I have the same problem with my application.
Probabily when you did:
if (DC.getDataSet.Tables["StockDetails"].Rows.Count > 0)
It continually to count your rows also after the last.
nicola_melc
27-Nov-14 5:11am
View
Very good ! Thank You so much.
nicola_melc
27-Nov-14 4:20am
View
Another question:
if I want to read from database my data (@things) and split it, how can i do?
I'm using this code:
SqlCommand dati = new SqlCommand(selezioneDati, connessione);
SqlDataReader dr = dati.ExecuteReader();
DataTable dt = new DataTable("dbo.ripRiparazioni");
dt.Load(dr);
if (dt.Rows.Count > 0)
{
txtNome.Text = dt.Rows[0]["Nome"].ToString();
txtCognome.Text = dt.Rows[0]["Cognome"].ToString();
dtpData.Value = Convert.ToDateTime(dt.Rows[0]["Data"].ToString());
txtAnno.Text = dt.Rows[0]["Anno"].ToString();
txtCellulare.Text = dt.Rows[0]["Cellulare"].ToString();
txtIndirizzo.Text = dt.Rows[0]["Indirizzo"].ToString();
txtCitta.Text = dt.Rows[0]["Citta"].ToString();
txtMarca.Text = dt.Rows[0]["Marca"].ToString();
txtModello.Text = dt.Rows[0]["Modello"].ToString();
txtNumeroSerie.Text = dt.Rows[0]["NumeroSerie"].ToString();
rtbProblemaRiscontrato.Text = dt.Rows[0]["ProblemaRiscontrato"].ToString();
//read here @things and split. So I can put checked my checkbox directly from database
}
}
nicola_melc
27-Nov-14 3:54am
View
Perfect, it was what I wanted !
nicola_melc
27-Nov-14 3:38am
View
So , I am creating an application to manage computer's repair.
When a customer leaves the PC , it could happen that leave the power adapter, mouse or some other object.
I use checkbox to manage this object.
I have 8 checkbox called : cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8.
I want to control if this 8 checkbox are checked.
And if are checked, write checkbox's name (cb1.Text or cb2.Text ....) into a sql parameter (@things).
For multiple control I refer to the if-else structure to do. Or how can i do? There is another way?
Maybe, now the problem is more clear.
nicola_melc
26-Nov-14 9:17am
View
No problem, I did it.
I used this code:
private void dgvListaRiparazioni_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView dgv = sender as DataGridView;
if (dgv == null)
return;
if (dgv.CurrentRow.Selected)
{
Chiusura chiusura = new Chiusura();
chiusura.ShowDialog();
}
}
nicola_melc
26-Nov-14 8:37am
View
OK, I've solved.
Thank you OriginalGriff for the help.
Sorry, I'have another question for you.
How can I select, using an event, a specific datagridview's row ?
nicola_melc
25-Nov-14 11:56am
View
In my table I have five lines.
With your code it works perfectly, but when debug is finished to control my "five lines" it continues to check other rows and goes in error.
nicola_melc
25-Nov-14 11:36am
View
Yes, I changed the name of the column.
I am a noob, but not so much :)
nicola_melc
25-Nov-14 11:24am
View
The code it's right, but I' ve an error.
When it finish the datagridview's rows, it continue to control and I have the error:
object reference not set to an instance of object
nicola_melc
25-Nov-14 7:46am
View
Deleted
Thanks, I'v solved using an Identity. Thanks a lot.
nicola_melc
18-Nov-14 8:29am
View
Thanks a lot.
I've solved my problem.
nicola_melc
20-Oct-14 3:42am
View
I've solved my problem.
I tried to launch directly netsh without using cmd.exe, but VS asked to me to execute the command with elevated privileges, so I added a file .manifest to run as administrator my application.
So, the command "netsh" works.
Thanks so much for the help, bye.
nicola_melc
17-Oct-14 8:25am
View
How can I run netsh as administrator in C#?
nicola_melc
17-Oct-14 6:05am
View
I have two forms:
In the first I use the command: netsh interface ip show config
I put in a listbox every network's name that I found. With doubleclickevent on the selected item I open the second form where I put manually IP, Subnet and Gateway.
I press a button (Confirm).
In the code I assign at the variable Nome_Maschera the Network's name from the first form. In my case, Maschera_di_Rete is the class and Nome_Maschera is the variable
nicola_melc
17-Oct-14 6:00am
View
I' ve tried from command line this:
netsh interface ip set address "Network's Name" static ip subnet gateway
It works correctly.
nicola_melc
17-Oct-14 5:36am
View
I don't now why VS add the symbol "\" before and after the network's name.
But, the command doesn't work. I don't have error at the end, but I have the addresses automatically assigned. The command must to assign it static
nicola_melc
17-Oct-14 5:08am
View
It doesn't work.
I already tried with this: procStartInfo.Arguments = ("/user:Administrator cmd /K " + comando.Replace(@"\",""));
The output is:
netsh interface ip set address Connessione alla rete locale (LAN) static ip subnet gateway
Show More