|
I don't understand what you're actually asking, but I suspect you don't fully understand what ref does, because the way you used it it's not doing anything.
Parameters passed with ref let the called function modify the variable which was passed by ref. For example:
static void modify(ref int x)
{
x += 10;
}
static void main()
{
int y = 5;
modify(ref y);
Console.WriteLine(y);
}
Since BindingList is a reference type, Some will refer to the same object as was passed in anyway, regardless of ref. And if it had been a value type (which it isn't, but if) then the assignment from some to Some would have copied it anyway. Reference types and value types are something completely separate from and orthogonal to ref.
|
|
|
|
|
I post much more detailed post above, have a look on it. Please ; and what is your thought about it
Thanks
|
|
|
|
|
nice example
Sankarsan Parida
|
|
|
|
|
ok, i think this post is dead
|
|
|
|
|
|
|
Im in need of some help.
I have VS2012. I have created a VSTO Word Template Project.
It has a few dialogs for choices and a Ribbon.
I have used Publish for the solution.
Clicking the template installs the customization, all ok.
I get a new document based on the template and then save that document.
Now a very real scenario is that the user then takes the produced document with them to Another computer and wants to open it there and view the file. Sounds like normal behavior to me.
However, if the template is not present the following message comes:
Microsoft Office Customization Installer
----------------------------------------
Installing Office customization
There was an error during installation.
Name:
From: <path where="" document="" is="">/template.vsto
Downloading file: <path where="" document="" is="">/template.vsto di not succeed.
Why in the World is the customization trying to be loaded when I simply open the document??
Normally if this was not a VSTO-Project, opening a document when the template is not present doesn't give any errors like this, can someone please tell me where I have gone wrong in asuming something like this?
The document consist of text and tables dependant on choices in the dialogs. I have added a ribbon to the template. Not much else.
I simply want the produced document to open to the user if the template is not available.
UPDATED:
Im beginning to suspect I should create an Application Level Addin instead of a Document Level Customization? Even if I do that, and that would solve my issue Im still very curios to why its not possible to open a document based on a VSTO-template without the template, well without the error messages?
|
|
|
|
|
Plz help me its urgent...
i want to connect marquee with database its urgent and important
thanks in advance...
|
|
|
|
|
|
i want to fetch column data from the database and run that data in marquee in short i want to create a update section for my website
thanks for the reply
|
|
|
|
|
Then you need to explain what you have tried and what problems you are having.
|
|
|
|
|
Hi
Im new to c#
Im using DAL which executes Datareader that returns a LIST<t> to my Business Layer which in turns passes it to the UI. I am trying to simulate
realtime instant searches with the text input box.
As a user types in a key, it again searches the db, and in turn updates the datagridlist.
On each key stroke a new list is being generated by the DAL
and passed to the gui.
The gui becomes abit slow and semi unresponsive.
The db query execute time worst case is around 20 miliseconds for each key stroke.
How do I get the GUI to be fully responsive while loading new lists for each stroke
IF there are better ways on doing this , I also like to know
thanks
Zak
|
|
|
|
|
The UI thread still has to be able to redraw the datagrid, so there are a couple of things you can do to improve performance is to do the database searches in a background thread and pass that to a method you Invoke on the UI thread to bind to the new data and redraw the grid.
The other thing is pretty simple. Limit the number of records you're returning from the search. Typically, you'd only need to display one page of data on the grid so don't return any more than that.
|
|
|
|
|
Have you considered not doing it that way, but filtering the binding source instead?
It's a lot easier, and means you don't need to issue new DB queries at all.
BindingSource.Filter[^]
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
In addition to the other suggestions, you might want to throttle your searches. If the user types four letters within half a second, they're probably not interested in seeing the search results for the first three.
Rx would be a good place to start:
http://rxwiki.wikidot.com/101samples#toc30[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
|
|
|
|
|
i want to add new column in my database table like unique id (primary key ) when import excel file to a table then automatic generate new add column to a table (unique id ) following code:-
protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string path = string.Concat((Server.MapPath("~/Data/" + FileUpload1.FileName)));
FileUpload1.PostedFile.SaveAs(path);
OleDbConnection OleDbcon = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;");
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet3$]", OleDbcon);
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(cmd);
OleDbcon.Open();
DbDataReader dr = cmd.ExecuteReader();
string con_str = @"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True";
// Bulk Copy to SQL Server
SqlBulkCopy bulkInsert = new SqlBulkCopy(con_str);
bulkInsert.DestinationTableName = "tbdata";
bulkInsert.WriteToServer(dr);
OleDbcon.Close();
Array.ForEach(Directory.GetFiles((Server.MapPath("~/Data/"))), File.Delete);
Label1.ForeColor = Color.Green;
Label1.Text = "successfully inserted";
FetchData();
newrow();
}
else
{
Label1.ForeColor = Color.Red;
Label1.Text = "Please select the File";
}
}
public void FetchData()
{
SqlConnection con = new SqlConnection(@"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select * from tbdata", con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GridView1.DataSource = rdr;
GridView1.DataBind();
}
public void newrow()
{
SqlConnection con;
SqlDataAdapter dladpt;
DataSet dldst;
DataTable mydt;
con = new SqlConnection(@"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True");
dladpt = new SqlDataAdapter("select * from tbdata", con);
dldst = new DataSet();
mydt = new DataTable();
dladpt.Fill(mydt);
DataColumn dcolColumn = new DataColumn("Link", typeof(string));
mydt.Columns.Add(dcolColumn);
DataRow drowItem;
foreach (DataRow row in mydt.Columns)
{
drowItem = mydt.NewRow();
drowItem["Link"] = "secret";
mydt.Rows.Add(drowItem);
}
GridView1.DataSource = mydt;
GridView1.DataBind();
}
}
|
|
|
|
|
Member 10578397 wrote: when import excel file to a table then automatic generate new add column to a
table (unique id )
ALTER the TABLE and ADD a COLUMN with an IDENTITY specification. It's done using SQL, not using datatables.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Greetings all.
I have 10 tabs with names tabPage01 to tabPage10. Inside those tabs there are textboxes named pathTXT01 to pathTXT10. Under each textbox there is a checkbox named changePath01 to changePath10. That check box is supposed to toggle .readonly for the textbox above it. So here is my function
private void changePath_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkTemp = sender as CheckBox;
string senderNumber = checkTemp.Name.Substring(checkTemp.Name.Length - 2, 2);
int tempMits = Convert.ToInt16(senderNumber);
string tempPathName = "pathTXT" + senderNumber;
TextBox papatrexas = ((TextBox)this.Controls[tempPathName]) as TextBox;
papatrexas.ReadOnly = !checkTemp.Checked;
}
Any help appreciated.
|
|
|
|
|
There are much, much better ways to do this.
Have a look at creating a UserControl[^]. This allows you to create a new control in your toolbox which can contain (and encapsulate) the text box and the check box - so the check box always knows which text box it is supposed to affect: there is only one as far as it is concerned!
Your code then becomes:
private void changePath_CheckedChanged(object sender, EventArgs e)
{
papatrexas.ReadOnly = !changePath.Checked;
} And everything becomes a lot easier to read and work with.
Usercontrols have constructors, properties, methods, events - everything a "normal" control does, so you can even create a UserControl which contains the whole of your tab page - and then just add one to each page in your TabControl instead of individual controls!
I use them a lot: they let me modularise the form a lot better and save a heck of a lot of time and confusion!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|