|
FunkyBeerMonster wrote: Class1 : CollectionBase
contains Elements of Class2
Class2 : CollectionBase
contains Elements of Class3
Class3 : CollectionBase
contains Elements of Class4
Class4
Isnt that just: Class4[][][] ?
|
|
|
|
|
Hi Leppie/Darren,
I think I have got this sorted now.. I have utilised the IXmlSerializer interface and with a small amount of tweeking, it seems to be sorted.
Thanks for your help!
Tom.
|
|
|
|
|
hi all,
how do i get a value in datagridview ?
cellValue = dataGridView1.Rows[0].Cells[1].ToString(); ??? how do i change this line ?
help please ...
thanks, bye.
|
|
|
|
|
If DataGridView works similar to DataGrid, then you
can use myDGView[row, col].ToString().
-Larantz-
|
|
|
|
|
I am new in C#.In doing a windows application
my form1 class has a Fee class that uses static methods,
i would like to use new_method in form1 class in the Fee class
i know i cant access methods in form1 class
,is there a way i can access form1's new_method without creating form1 object in Fee class?
public partial class Form1 : Form
{
public delegate void new_foo_delegate();
private MyUserControl mycontrol;
public class Fee
{
public Fee()
{
}
private void button1_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(Run));
t.Start();
}
public static void Run()
{
invoke(new new_foo_delegate(new_method));//NB the method in my main
}
}
public Form1()
{
InitializeComponent();
}
public void method()
{
mycontrol.Dipslay(txtbox);
}
void new_method()
{
textBox1.Text = "Hullo";
}
}
}
nb this is just an example
hope my question is very clear
thanks
regards paula
|
|
|
|
|
PaulaM wrote: is there a way i can access form1's new_method without creating form1 object in Fee class?
Sure, as long as an instance of Form1 exists, you can expose that instance to the Fee object (that would be a broken design) any way you like and then call it's new_method() member. You cannot call new_method() without an instance of Form1.
|
|
|
|
|
If you are calling a non-static method then you need an instance of the class that contains the method. What exactly are you trying to do? Perhaps there is a better way?
One thing you might think about is could you have a static member in your fee class of type form1? That way you'd only have to create an instance of form1 once in your fee class.
|
|
|
|
|
i am using DSOFramer ocx control and i am getting error!
"Catastrophic failure"
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Catastrophic failure
Source Error:
Line 74:
Line 75: axFramerControl1.Titlebar = false;
Line 76: axFramerControl1.CreateNew("Word.Document");
Line 77: //axFramerControl1.Open(("http://localhost//Sample1.doc");E:\TEST Doc
Line 78:
pls do help me out!
Thanks in Advance!!
|
|
|
|
|
hi all,
I'm having a bit of an issue here and maybe one of you guys can help me out .
I'm looking for a way to return all COMPONENTS in a form during run-time, and i mean components including all controls , menu's, custom controls etc.
As you all now a control is a component but a component is not a control.
You will probably think that i'm somesort of idiot , but i'm not (at least i think i'm not), and i've tried every possible way to reach my goal:
1) tried to convert the form as container -> didn't work
2) adding the component that needs to perform above actions and using it's own container as componentcollection holder doesn't work, bcause the container returned is the component itself.
3) returning a menu's container -> doesn't work -> it always returns nothing
batmike2000
|
|
|
|
|
Can you do something like this?
List<IComponent> components = new List<IComponent>();
foreach (object obj in myForm.Controls)
if (obj is IComponent)
components.Add(obj as IComponent);
You might have to do it recursively though.
Last modified: Wednesday, May 31, 2006 12:24:40 PM --
|
|
|
|
|
That won't work because, as the original question mentioned, all controls are components but not vice versa (Control derives from Component). Components are not in a form's Control tree.
Josh
|
|
|
|
|
How about reflection then? You can do a GetMembers() on the form's Type and look for fields. See if that field type is an implementation of IComponent, and add it to the list.
List<IComponent> components = new List<IComponent>();
foreach (MemberInfo mi in this.GetType().GetMembers()) {
if (mi.MemberType == MemberTypes.Field) {
if (mi.DeclaringType.GetInterface("IComponent") != null) {
FieldInfo fi = mi as FieldInfo;
components.Add((IComponent)fi.GetValue(this));
}
}
}
I haven't tested this code, but it should be pretty close. Last modified: Wednesday, May 31, 2006 12:25:05 PM --
|
|
|
|
|
Hi Dustin
tnx for the reply, unfortunately it doesn't seem to work. Maybe i should dig in a little deeper, but i don't think this can work because imho components aren't fields . Tnx for the effort anyway.
Maybe i shoud try another approach. If I just could get the correct container from my component (ie. the form it's hosted on but then defined as container instead of form).
BTW: i'm still using .Net 1.1 and not 2.0, just to avoid confusion.
batmike2000
|
|
|
|
|
hi guys,
i've found the solution: i indeed needed to use reflection but on fieldinfo level
<br />
strFormName = param_Form.Name<br />
<br />
Dim param_Form_type As Type = param_Form.GetType()<br />
Dim compFields As FieldInfo() = param_Form_type.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic)<br />
For Each fiField As FieldInfo In compFields<br />
Dim strCtrl(1) As String<br />
strCtrl = ReturnCompName(fiField, param_Form)<br />
For Each dr As DataRow In myrs.Rows<br />
If strCtrl(0) = dr("SecAuthCtrl_Name") And fiField.FieldType.FullName = dr("SecAuthCtrl_Type") Then<br />
Select Case fiField.FieldType.FullName.ToLower<br />
Case "System.Windows.Forms.ToolBarButton".ToLower<br />
Dim cmp As ToolBarButton = DirectCast(fiField.GetValue(param_Form), ToolBarButton)<br />
cmp.Enabled = dr("SecAuthorized_Enabled")<br />
cmp.Visible = dr("SecAuthorized_Visible")<br />
Case "System.Windows.Forms.MenuItem".ToLower<br />
Dim cmp As MenuItem = DirectCast(fiField.GetValue(param_Form), MenuItem)<br />
cmp.Enabled = dr("SecAuthorized_Enabled")<br />
cmp.Visible = dr("SecAuthorized_Visible")<br />
Case Else<br />
End Select<br />
End If<br />
Next<br />
Next
this works now,
tnx again for your effort
batmike2000
|
|
|
|
|
|
Hi,
My requirement is to set combobox column for deptno column of the table dept.
When insert button is clicked,i write the following code
DataGridViewComboBoxColumn cell = new DataGridViewComboBoxColumn();
cell.DataPropertyName = "DEPTNO";
cell.HeaderText = "dno";
cell.Items.Add(10);
cell.Items.Add(20);
cell.DataSource = ds.Tables["dept"];
cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
dataGridView1.Columns.Add(cell);
dt=new DataTable();
dt = (DataTable)dataGridView1.DataSource;
DataRow dr = dt.NewRow();
dt.Rows.Add();
dataGridView1.DataSource = dt;
My problem is that combobox column is displayed as a separate column.But it value member set to deptno column of dept table.And when i select 30 from that combo box control goes to deptno=30 row.
I want combox cell is set for deptno column and when we select a value from that combo box column the velue is displayed for that row.
How to do this.
Thanks in advance.
|
|
|
|
|
The DTE object is the Development Envirnoment object for VS.
But, I can't create it.
Has anyone changed it so they can use it?
If so, what exaclty did you change to get permissions?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I know the StatusBar does not have the backColor property associated with it so i was trying to change the colour through an API call. However my code does not seem to work even though many people have managed to do it. Am i doing something wrong here? Any help would be appreciated.
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public extern static void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
public void ChangeStatusBarColour(System.Windows.Forms.StatusBar sbar, int color)
{
int CCM_FIRST = 0x2000;
int SB_SETBKCOLOR = (CCM_FIRST + 1);
SendMessage(sbar.Handle, SB_SETBKCOLOR, 0, color);
}
And in my derived StatusBar class i have this call to the previous object:
manipStatus.ChangeStatusBarColour(this, 10929647);
thanks in advance.
|
|
|
|
|
See this:
http://support.microsoft.com/default.aspx?id=319311
|
|
|
|
|
Ahhh Excellent, thanks. Not sure how i didnt come across it earlier
Darren
|
|
|
|
|
I use axWebBrowser, but i don't know how to do this.
Help me please.
|
|
|
|
|
What is the use of nGen(native Image Generator), How to Use it
Subbu
|
|
|
|
|
|
Hai All
I have created a custom menuitem in the tools Menu on click of which a windows form is launched that contains a simple textbox and ok Button.
This Custom menu will be available in .NET IDE . When i open a new project in the IDE and Click my Custom menu the above mentioned form will be opened . Now My requirement is that i shd get a .cs file added automatically to the solution of the currently working project om the click of the OK button....
Can u pls help me out
Pavithra
|
|
|
|
|
Just read all answers to your "SAME" question :
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&mpp=50&select=1510871&df=100#xx1510871xx
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&mpp=50&select=1510433&df=100&fr=51#xx1510433xx
|
|
|
|