|
|
Thanks for reply.
I am using VS 2003 and vs 2005 also. and I get same error in both.
|
|
|
|
|
Hi,
I am having a class Btree, its has function to print pre-order of binary tree on the form.
problem is that, i am not able to access label on the form from this BTree.cs file.
I made that label as public in form.cs file, even i am not able to access.
can any one pls tell me, how can i access form objects from other class file.
|
|
|
|
|
Your binary tree class (Btree) needs to get a reference to the Form class of which the label is on. There're a few different ways to handle the interaction between the two in regards to how loosely coupled you want them to be however the easiest thing to do would be to pass in a reference to the form object through the Btree constructor...
|
|
|
|
|
Hi
Thanku 4 reply
Can U pls give some example code.
or refer me to the any tutorial.
|
|
|
|
|
Sure, so if we had a label on the form that we wanted to update by code in some other class you would do the following:
In your form code you would expose the label as a property...
delegate void Func();
...
public string MessageText
{
get
{
return label1.Text;
}
set
{
Func del = delegate
{
label1.Text = value;
};
Invoke(del);
}
}
Then we can create a new instance of the Btree class (in this case I'll just create it from the Load method of the form)
Btree myBtree = new Btree(this);
"this" refers to the Form class instance itself.. so for the constructor of the Btree class I'd have
public Btree(Form1 frm)
{
frm.MessageText = "This is a test";
}
Since you have a reference to Form1 you can get/set properties and call methods on it. It is, however, better practice to create an interface that states what properties/methods the form should support of which other classes would make calls to so you dont tie yourself down to specific class/form names... but I dont think that would be a big concern for you at this point in time :P
|
|
|
|
|
Hi all,
I am using ProcessStartInfo to print file from my application.
I am also allowing user to change printer and printer settings from PrintDialog Box ( PrintDialog Object).
But Changes done by User is not refelected.
Anyone knows Y.
I have used SetDefaultPrinter API to set changed printer to default.
I guess I will have to use those API to set Printer Settings as well.
Any other solution?
|
|
|
|
|
|
Thanks For reply but this not the thing I am doing.
|
|
|
|
|
What's the difference between a combobox.DataSource and a DataGrid.DataSource?
If I do this in my code:
mycombobox.DataSource = dbconn.GetDataSet().Tables[0].DefaultView;
mydatagrid.DataSource = dbconn.GetDataSet().Tables[0].DefaultView;
the datagrid gets filled with the correct values, the combobox with "System.Data.DataRowView" items.
In .Net 1.1 however this problem didn't occurred, or did it?
tnx for your help.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
Dunno about .Net 1.1, but I just ran across this issue as well. I used the DisplayMember property (in conjunction with DataSource) to properly display the value in a ComboBox/ListBox control. Otherwise I just saw the name of the object.
www.lovethosetrains.com
|
|
|
|
|
And idd it works !!
It does seem logical, but why don't they put that kind of info in MSDN .
tnx
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
hi there
i have a problem
i've build a project in visual studio 2003, this program can select a row from a datagrid and opens up a new form with the detail data in this form.
i've now instaled visual C# 2005
and i'm rebuilding the application.
but the currenrowindex is not working he has no definition for it is the error he givs me.
i've search in my old project to the definition for this and there is this line of code:
public int CurrentRowIndex { get; set; }
in the DataGrid[from metadata]
and this file is locked can't change it.
but this line of code is in that file.
in my other project he isn't.
and i can't add it cause i can't adjust this file.
can someone tell me how to put this line of code there or maybe some other solution?
|
|
|
|
|
hi i have a problem with browser application, Now i develop a browser form with use of Internet Explorer's componant but the problem was assign the shortcut keys,If Any body know plz help me
regards
ranandbe
|
|
|
|
|
Not really sure what your problem is here, however, shortcuts for the browser component can be turned on/off via the WebBrowserShortcutsEnabled property (default is "True").
Are you trying to assign -new- shortcut keys to perform actions on the browser component? If so, I dont think the browser component itself has any additional features to assist in new shortcut keys; you need to catch the key presses yourself and perform the required custom actions from there.
|
|
|
|
|
Hi
Thank you, My problem is "In IE browsers no need to type full address like protocal,web server and domain's just enter the url name and press Ctrl+Enter then it will auto complete the url and how to maintain history in addressbar " i need this feature in my application.How to solve this problem.
Regards.,
ranandbe
-- modified at 0:56 Thursday 4th May, 2006
|
|
|
|
|
Ah ok... well, same concept applies in that you should catch a Ctrl-Enter (and any other key press combo) and perform the url completion as needed. There are a few articles here on CodeProject that deal with the Url / Url History issues that you may want to check out // http://www.codeproject.com/csharp/ponta.asp[^]
|
|
|
|
|
hi
i want connect to access db that include password but i don't do that because that give an error ..
that it's open exclusive by another app (but access was closed).
how to that ?
please give a source that connect to access db waith password ...
thanks ...
|
|
|
|
|
This might help
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=adminpassword;"
or goto http://www.connectionstrings.com/ for details
Shajeel
|
|
|
|
|
how to put compobox/other controls into datagrid if u can help to code <for windows="" application="">
urgent
Amal
-- modified at 8:28 Wednesday 3rd May, 2006
|
|
|
|
|
use template column in datagrid and in that template column you can use any control like combo or text box or radio button or check box etc.
|
|
|
|
|
Hi all,
I converted some VB code to C# for the purpose of setting a default button for a text box. The method has no reported errors but when i try and call the method i get the following error:
'Item_search' is a 'type' but is used like a 'variable'
I've tried calling the method in the following ways:
//Item_search is the name of the page (Item_search.aspx)
1: DefaultButton(Item_search, tb_item_description, btn_search);
2: Item_search page = new Item_search();
DefaultButton(page, tb_item_description, btn_search);
//Method for default button
public void DefaultButton( ref System.Web.UI.Page Page, ref TextBox objTextControl, ref Button objDefaultButton)
{
...................
}
Any help would be great
|
|
|
|
|
Use a reference to the current page as the first parameter.
---
b { font-weight: normal; }
|
|
|
|
|
Hey,
I'm trying calling the method from the same page as its setting focus for. Would it be possible for you to provide an example of what you mean?
public void DefaultButton( ref TextBox objTextControl, ref Button objDefaultButton)
{
.......
}
This is what I'm trying:
DefaultButton(Item_search / "Item_search.aspx" / creating an instance of Item_search and calling that
, ref tb_item_description, ref btn_search);
But get no love from any of them. Please help This is doing my head in!
acsc
|
|
|
|
|
DefaultButton(this, ref tb_item_description, ref btn_search);
---
b { font-weight: normal; }
|
|
|
|