|
When i plot in the chart, i found chart speed is slower than other soft. Now i think chartarea refresh is cost most of time, but some times i don't need to refresh background series, just need to use invalidate to call paint function.
So is there any method to stop backgound series refresh ,not refresh paint function content?
|
|
|
|
|
No, there isn't, and YES, you HAVE TO PAINT THE BACKGROUND, which means painting the entire chart area. It's the only way to "undo" the previous painting of your rectangle so it can be repainted with it's new coordinates and size.
|
|
|
|
|
oh, but why some other soft can work so fast? Maybe other language can good work for this?
|
|
|
|
|
The language used doesn't matter at all. What does matter is the design of your graphing component, which you didn't write. You're trying to adapt a graphing component that isn't designed to do the job you want to do.
If you make your own graphing component that also supports drawing boxes on it and is OPTIMIZED to support what you want to do, then you can get the speed out of it.
|
|
|
|
|
|
i want is that, when i fetch data from database then labels dynamically added to my form.
i have a code but this show only one data, i want total result of query generate automatically label and set data into label.
my code is .
`
con.Open();
DataTable table = new DataTable();
string sqlText = "SELECT DATEDIFF(DAY, [meas_duedate], GETDATE()) , meas_id, client_id FROM tlb_meas_master"
SqlCommand cmd = new SqlCommand(sqlText, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
}
lbl_date.Text = dr.GetValue(0).ToString();
lbl_mea_id.Text = dr.GetValue(1).ToString();
lbl_cli_id.Text = dr.GetValue(2).ToString();
}
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.Message);
con.Close();
}
`please help me....
|
|
|
|
|
You already posted this in the QA section. Don't post the same question multiple times.
|
|
|
|
|
With above code it will only show you last record value as you iterate records with data reader object
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Hello All,
i have command - Get-WmiObject -Query "select * from win32_printer" -ComputerName ""
I would like to use Textbox with c# instead type computer type manually. How can i accomplish it?
Thanks.
|
|
|
|
|
|
we have ecomerance site. we are trying to flipkart seller api. to display our products in flipkart.
i am unable get start with work. not getting idea how to call REST API with OAuth.
from flipkart site it is showing to call.
oauth/token?grant_type=client_credentials&scope=Seller_Api,Default
not having idea how to call from c#.Net
Please any guide or help how call rest api with oAuth in c#.Net
Thanks,
Raja Ramesh
raja
|
|
|
|
|
What is wrong with this code that is not updating my datagrid and consequentetly the data base table? Thank you for any help.
using (OdbcConnection connection = CreateConnection())
{
string CmdText = "update lojas set Bloqueado =@bloqueador, DataFim = @DataFim, Nome = @Nome where Id =@Id";
OdbcCommand cm = new OdbcCommand(CmdText, connection);
cm.CommandType = CommandType.Text;
connection.Open();
cm.Parameters.AddWithValue("@Id", grid_lic.CurrentRow.Cells[0].Value);
cm.Parameters.AddWithValue("@bloqueador",grid_lic.CurrentRow.Cells[3].Value);
cm.Parameters.AddWithValue("@DataFim",grid_lic.CurrentRow.Cells[4].Value);
cm.Parameters.AddWithValue("@Nome",grid_lic.CurrentRow.Cells[6].Value);
cm.ExecuteNonQuery();
|
|
|
|
|
There is no code here to update the datagrid. You would need to refresh it after the database has been updated. E.g. set the datasource to null and then rebind it or use a BindingSource.
If the database is not being updated by this query then debug it to ensure the value for Id matches what you have in your data
|
|
|
|
|
When I change the data in the cells of the DataGridView, and I debug, the values that are shown are the new ones, but at the end the DataGridView is not updated. Can you please give an example of possible code to complete what I already have? Thanks.
|
|
|
|
|
How do you populate the DataGridView? And how are you changing the data in the cells? By typing over what is there? What do you mean by "at the end" ... at the end of what?
|
|
|
|
|
By the end I mean after cliking in the button "upgrade" where this code is inserted. I change data by typing over what is in the cell.
I populate the datagrid this way:
using (OdbcConnection connection = CreateConnection())
{
OdbcCommand Command = new OdbcCommand("insert into lojas (NIF, Loja, bloqueado, DataFim, lastupdate, Nome) values (?, ?, ?, ?, ?, ?)", connection);
Command.CommandType = CommandType.Text;
Command.Parameters.AddWithValue("@N IF", grid_lic.CurrentRow.Cells[1].Value);
Command.Parameters.AddWithValue("@Loja", grid_lic.CurrentRow.Cells[2].Value);
Command.Parameters.AddWithValue("@Bloqueado", grid_lic.CurrentRow.Cells[3].Value);
Command.Parameters.AddWithValue("@DataFim", grid_lic.CurrentRow.Cells[4].Value);
Command.Parameters.AddWithValue("@lastupdate", grid_lic.CurrentRow.Cells[5].Value);
Command.Parameters.AddWithValue("@Nome", grid_lic.CurrentRow.Cells[6].Value);
Command.ExecuteNonQuery();
}
|
|
|
|
|
Ok - that code is not populating the datagrid it's updating the database - are you saying that the DataGrid is bound to the database?
You refer to this as a DataGrid - is this in an ASP page? In which case are you checking for PostBack?
|
|
|
|
|
The datagrid is bound to the database. This is the connection command:
private static OdbcConnection CreateConnection()
{
return new OdbcConnection("driver= {MySQL ODBC 5.1 Driver};server=192.168.19.78; database=licenciamento; uid=estagio; password=1234; option = 3 ");
}
It is not an ASP page, it is only windowsform.
|
|
|
|
|
Hi, all friends:
i want to get a efficient function to sort array, and return a old array index .
For example: double[] a=[5,4,1,3,2];
how can i get b is [1,2,3,4,5],and index array c is [2,4,3,1,0]?
i want a efficent and quick method...
|
|
|
|
|
There is no built in method that will do that for you - the index to the previous array is what causes the problem - and you can't "retrospectively" find it because in the event of duplicates, you don;t know which value to use.
What I would probably do is package the value you want to sort into a struct together with it's original index and sort that, using a comparator that looked only at the values.
The resulting sorted info would include the original array index, and it would be pretty trivial to split them back up if you needed to.
public struct sortable
{
double value;
int index;
}
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Array.Sort has an overload that takes and array of keys and an array of values. If you sort [0,1,2,3,4] with the keys [5,4,1,3,2], it will give you [2,4,3,1,0], as you wanted.
sandbox[^]
modified 15-Dec-15 7:54am.
|
|
|
|
|
good idea,smart!!!
and i would to know how to generate array 0 to 100 , not use loop?
|
|
|
|
|
Apart from typing it out manually? Just use a loop.
int[] index = new int[100];
for (int i = 0; i < index.Length; i++)
index[i] = i;
inb4 Enumerable.Range(0, 100).ToArray() - oh sure, but that has the same loop, and also does a bunch of array allocations and copies. Sweeping a loop under the rug doesn't make it go away.
|
|
|
|
|
|
A little Linq, perhaps:
int[] iary = new[] { 5, 4, 1, 3, 2 };
var sorted = iary.OrderBy(itm1 => itm1).ToArray();
var unsortedIndexes = sorted.Select(itm2 => Array.IndexOf(iary, itm2, 0)).ToArray(); Note that using 'OrderBy creates a copy of the Array.
>? sorted
{int[5]}
[0]: 1
[1]: 2
[2]: 3
[3]: 4
[4]: 5
> ? unsortedIndexes
{int[5]}
[0]: 2
[1]: 4
[2]: 3
[3]: 1
[4]: 0
> ? iary
{int[5]}
[0]: 5
[1]: 4
[2]: 1
[3]: 3
[4]: 2
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
modified 15-Dec-15 11:23am.
|
|
|
|
|