|
Dear Experts,
I have datagridView with tow columns.
I use the below code to get value from Cell the cursor left, but when cursor left for first time, even if I filled a value, the message box give me "Blank" notjing, but if I returned to the cell and leave it again, then message give me the Value. I have searched in google, but with no result.
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
string x = (string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
MessageBox.Show(x);
}
Your help please.
Ahmad,
|
|
|
|
|
Just subscribe to the CellValueChanged[^]-event instead of the CellLeave-event.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
put datagridview1.EndEdit() above
string x = (string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
statement
|
|
|
|
|
It is working, Thank you
|
|
|
|
|
Currently i have painted top portion of a panel as header for this panel but if in design time I am setting a child control inside that panel as dockstyle bottom while resizing this control is overriding panel of that header.so I want header should be always on top or over the child controls
Pls help me
|
|
|
|
|
Sorry?
Perhaps punctuation would help...
Stop just typing as fast as you can, and thing about the people who have to read your question: that is all we get to work on. We can't see your screen, we can't access your hard disk, and we can't read your mind!
So explain in some detail what you expect to happen, and what did occur. Sometimes drawing little "ASCII-art" pictures can help:
_____
| 1 | 1 - Header
|-----|
| |
| 2 | 2 - Rest of panel
| |
----- And then drawing others to show what you expected, and got.
And relevant code fragments help as well!
The better the info you give us, the better the response we can give you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Add a new panel to your panel. Have it dock to "top". Make it as high as the header should be. Paint the new panel as if it is the header.
When adding a control, add it to the original pannel, using dock set to "fill". May require an additional BringToFront or SendToBack.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi, If change EmployeeName in dropdownlist I can Get clientState value have empId in mvc DayPilot Calendar Current control.It will work. If i navigate to Day or Month view then DayPilot control cannot update Event of Employee and Client state is 0.
Here my Coding
In Jquery...
$(#ddlProviderSched).change(function () {
var ProviderId = $(this).val();
if (ProviderId != null) {
switcher.active.control.clientState.ddlProviderSched = ProviderId;
switcher.active.control.commandCallBack(refresh);
}
})
in C# MVC Controller Page....
protected override void OnCommand(DayPilot.Web.Mvc.Events.Month.CommandArgs e)
{
switch (e.Command)
{
case "navigate":
StartDate = (DateTime)e.Data["day"];
Update(CallBackUpdateType.Full);
break;
case "refresh":
Update(CallBackUpdateType.EventsOnly);
break;
case "delete":
new EventModel().EventDelete((string)e.Data["e"]["id"]);
Update(CallBackUpdateType.EventsOnly);
break;
//case "filter":
// string Provider1 = (string)e.Data["Provi"];
// Events = new EventModel().FilteredData(StartDate, VisibleEnd, Convert.ToInt32(Provider1)).AsEnumerable();
// Update(CallBackUpdateType.Full);
// break;
}
}
protected override void OnFinish()
{
if (UpdateType == CallBackUpdateType.None)
{
return;
}
//Events = from e in dc.TimesheetRecords where e.EmployeeId == employee select e;
int Provider = SelectedEmployee();
Events = new EventModel().FilteredData(VisibleStart, VisibleEnd,Provider).AsEnumerable();
DataIdField = "Id";
DataTextField = "Reason";
DataStartField = "eventstart";
DataEndField = "eventend";
}
public int SelectedEmployee()
{
if (ClientState["ddlProviderSched"] != null)
{
var ProId = (string)ClientState["ddlProviderSched"];
return Convert.ToInt32(ProId);
}
else
return 0;
}
|
|
|
|
|
|
I have a sqlite database protected by password and I can't use it in query. How should I modify the code to read data from a protected database?
private static string conn = @"Data Source=aplicatie.db;Pooling=true;FailIfMissing=false;Version=3;Password=example";
An example with query:
string selectutilizator = "SELECT username,prenume,licenta FROM accounts";
SQLiteCommand selcom = new SQLiteCommand(selectutilizator, Conexiune.getConnection());
selcom.CommandType = CommandType.Text;
using (SQLiteDataReader read = selcom.ExecuteReader())
{
if (read.Read())
{
SimulatorManager.Nume = (string)read["username"];
SimulatorManager.Prenume = (string)read["prenume"];
SimulatorManager.Utilizator = SimulatorManager.Nume + " " + SimulatorManager.Prenume;
}
}
Error is:
file is encrypted or is not a database
|
|
|
|
|
Are you sure that the password is correct?
|
|
|
|
|
My next stupid question is: How should I suppose to set a password for sqlite database? ) Cause obviously I don't know how..I thought that I just have to set there a password..
|
|
|
|
|
Speaking for myself, I would start by reading the documentation.
|
|
|
|
|
DPaul1994 wrote: How should I suppose to set a password for sqlite database?
private static string conn = @"Data Source=aplicatie.db;Pooling=true;FailIfMissing=false;Version=3;Password=example"; What happens if you connect using this to a non-existing file?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
As Richard says, the wrong password is the most obvious problem.
Other possibilities are:
1) It's not an SqLite database at all - ".db" is a common enough extension that it could be a different application
2) It's SqLite, but from a different version - check that the DLLs you are using to access it are the latest version, and that you didn't create it in a later application.
If in doubt, it's worth setting up a connection in Visual studio via the Server Explorer pane - if "Connect to Database" doesn't list SqLite then see here: http://stackoverflow.com/questions/19665370/missing-sqlite-data-provider-in-vs-2013[^]
Once you have a working connection in VS, you can get a "good" connection string in the Properties Pane.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have a new pc and installed new software. Visual Studio 2013 and SQL Server 2014. My old pc had VS 2010 and SS 2012.
Now I have the problem that I created code for working with DTS packages. Worked perfect on the old pc. But the dll is in the GAC of Windows. My new pc has a newer version and won't work. The problem is, that the server where it has to be hosted, also works with the old verion (SS 2012)
I tried to copy the old dll from the GAC and reference it in my new environment, but without luck.
I cannot imagine that I have to install the old software as well on my new pc. I mean, what do you do when your customer has older or newer version in GAC. You must be somehow able to program for that situation.
Anyone any ideas?
|
|
|
|
|
Well, I would suggest you to have a virtual machine on your new PC(VMWare free version). Install all that old software and save the VM on an external drive. This will make it ready to use as and when required.
Your customer will keep coming back to you to get this stuff fixed. This way, you just have to boot your virtual machine and get the job done.
|
|
|
|
|
Hi guys,
I was wondering if there is any impact of the Memory (private working set) towards the performance of the windows services.
I developed a Windows Service program in C#.
Basically what it does is, reading an unstructured text file and then converting it to a structured text file.
File size ranging 1GB to 2GB per file, in multi-threaded.
As what I noted, the higher the Memory (private working set) from the Task manager; it goes, the poorer the program to read and write file.
I already troubleshooting and recode the program in any ways. Still no luck
Any comments to the above, very much appreciated.
Thanks
|
|
|
|
|
Please do not post the same thing in multiple places: it duplicates work and annoys people.
You already have a solution in QA: What to ask: Memory (private working set)[^] so just continue with that one.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Possibly. It depends on how much RAM is in the machine. What's probably happening is that you're getting a lot of swaps back and forth to the page file. Look in Task Manager at the Page Fault and Page Fault Delta columns. You'll probably have to turn these on in the View menu to see them.
Oh, and don't look in Task Manager to see how much memory your .NET app is using. It's lying to you.
|
|
|
|
|
Hello guy as the subject this error shows up and don't know what is the error
Error:System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.SOrder_Click(Object sender, EventArgs e) in c:\Users\BC 2\Documents\Visual Studio 2013\WebSites\One Touch Service\Default.aspx.cs:line 39 ClientConnectionId:714e7bcb-5bba-41ab-a493-8f7bf33259b9
|
|
|
|
|
And what is your code? Remember that, just because you can see it we can't.
|
|
|
|
|
abdokouta wrote: String or binary data would be truncated.
What's so hard to understand? You're trying to cram too much data into a field that has some hard limit on the size of the data it can hold.
If we can't see your code and table definition we can't really help any more than this.
|
|
|
|
|
this is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
RecievedTime.Text = DateTime.Now.ToString();
if (IsPostBack)
{
}
}
protected void SOrder_Click(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Data"].ConnectionString);
conn.Open();
string insertQuery = "insert into OrderData (RoomNumber, OrderCode, Details, ReceviedBy, AssignedTo ,RecievedTime) values (@RNumber, @OCode, @Det, @RBy, @Assto, @RTime)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@RNumber", RoomN.Text);
com.Parameters.AddWithValue("@OCode", OrderCode.SelectedItem.Text);
com.Parameters.AddWithValue("@Det", Details.Text);
com.Parameters.AddWithValue("@RBy", Receby.SelectedItem.Text);
com.Parameters.AddWithValue("@Assto", Assto.SelectedItem.Text);
com.Parameters.AddWithValue("@RTime", RecievedTime.Text);
com.ExecuteNonQuery();
Response.Redirect("Login.aspx");
Response.Write("Registration SUCESSFULL");
conn.Close();
}
catch (Exception ex)
{
Response.Write("Error:" + ex.ToString());
}
}
}
and i have great a database called Data and there is table in called OrderData and the connection is Orders
|
|
|
|
|
Check if any of the values you are passing is more than the length of the columns in database.
Siddartha K,
.NET Developer,
Wipro Technologies,
India.
|
|
|
|
|