|
Hello to all,
I have a dialog box that for now I want to inject the user name and password directly,
I added the values to main and passed to the correct place in the program.
the only problem is the dialog opens and waits for someone to press the "OK" button to proceed.
I want to make the box close by performClick() it self or some other alternative to achieve the same result.
I want this:
if (frmLoginUser.ShowDialog() != DialogResult.OK)
{
return;
}
to exist, but automatically press it's own OK button without any value passed to Dialog.
thank you very much for the help.
|
|
|
|
|
You don't need to click a button to set the dialog result. So you could just add in this.DialogResult = DialogResult.OK and then close the form.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
thanks man that's right,
How come I didn't think of that guess to mixed up with other stuff,
sorry for disturbing you on such a small matter
have a great day.
|
|
|
|
|
This is my first attempt at inheritance, and it seems to be working okay, but I want to be able to assign a back color to visual show that the sub-item has been selected (new property I gave it). I used the Reflector to see how the code is done on the original ListViewSubItem, but I can do it the same as, as they assign the back color to the SubItemStyle, and I can't get to that since it's protected. Is there any other way to do what I want, or am I out of luck? Thanks in advance.
Tim
|
|
|
|
|
|
Thanks you! This has been bugging me for a couple of weeks. I don't know how I missed that property of the ListViewItem, but it seems to be what I'm looking for.
Tim
|
|
|
|
|
I have 2 classes
class Attribute<t>
{
string attributeID;
T[] values;
}
When instantiated, it holds several int's, decimals or strings
2nd class should hold several DIFFERENT Attributes. Here I am getting problem:
class Node
{
ArrayList attribArray;
AddAttribute(Attribute<t> inAttrib)
{ attribArray.Add(inAttrib;}
}
It compiles, but I cannot find a way to get stored Attributes
runtime
Example: I need a list of values from 2nd attribute in
my attribArray
Any thoughts, please
|
|
|
|
|
public class Node : List<attribute>{} //No code needed.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: public class Node : List{} //No code needed
System.Collections.Generic.List<t> requires 1 type argument
I need to keep several _diffrent_ Attributes
|
|
|
|
|
hi,
1.
when retrieving an item from an ArrayList you need to cast to the original type.
string str1="aha";
ArrayList list=new ArrayList();
list.Add(str1);
string str2=(string)list[0];
2.
when storing different types in a generic, you need to specify a common type
(it could be object or any common ancestor of your types).
3.
since an ArrayList is not an array, I would not call one instance attribArray,
I would suggest either attribList or attribs.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
>1.when retrieving an item from an ArrayList you need to cast to the original type.
I know that. Two issues though: (a) where to get information on the type of stored Attribute
(b) how to succesfully unbox object to Attribute<int>, Attribute<string> etc.
>2.when storing different types in a generic, you need to specify a common type
(it could be object or any common ancestor of your types).
I thought that adding an onject to an ArrayList does it automaticaally (I mean conversion to the Object type)
>3.
I am not going into this
SO, I am still in limbo. Thank you for trying to help me
|
|
|
|
|
Hi,
1.
you can retrieve an object from any ArrayList, then check its type, e.g.
object obj=list[0];
Button btn=obj as Button;
if (btn!=null) btn.PerformClick();
2.
ArrayList does not care about the types of objects it is holding.
A generic collection such as List<T> is different:
- it will only accept objects of type T (or derived from T)
- it will automatically return objects of type T, without needing a cast
(making it both safer and faster).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: 1.you can retrieve an object from any ArrayList, then check its type, e.g.
object obj=list[0];
Button btn=obj as Button; // gives either a real Button or null
if (btn!=null) btn.PerformClick();
(a) my objects are Attribute<int>>, Attribute<string> etc. Should I try to cast all variety?
(b) to my great surprise, when I did your line 1 it did return an object with type name
"<assemblyname>.Attribute`1". Here 1 stays for 1 parameter. Moreover, FullName showed this parameter type like String.string in my case
Oh, Mighty Reflection,, the problem is solved
2. I cannot use List<T>, can i? My objects are all different types
thanks
-- modified at 6:35 Thursday 29th November, 2007
|
|
|
|
|
I am creating a windows application using vb .net 2005 (i don't mind c#) and sql server 2005.
i want to print a local (embedded) rdlc report without showing it.
is it possible?
if not, then how do i print the report (displayed in reportiviewer) without showing print dialog.
Thank you.
|
|
|
|
|
People usually frown upon cross posting y'know. Prepare ye'self.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
|
Thank you Giorgi for the link, I checked out the link, but it uses Reporting Services. and I don't want to use Reporting Services.
My application is actually a Point of Sale which prints the Transaction Bills (embedded report).
Showing the report in the reportviewer and then showing the print dialog irritates the user
alternately, is there any way to print the report to the default printer without showing print dialog.
thank you once again.
|
|
|
|
|
I am trying to datasource a gridview within a repeater. I am having issues passing the data from the repeater to the gridview (either to source it manually or set the Gridview's SQLDataSource attributes wtihin the Repeater_ItemDataBound event.)
The XML will look similar to this (all dummy data):
<root>
<Unit type="District" number="221">
<Employee name="Joe Smith" unitType="Store" unitNum="2213" reviewStatus="Pending" empNum="12345"></Employee>
<Employee name="James Jones" unitType="Store" unitNum="2365" reviewStatus="Pending" empNum="23654"></Employee>
</Unit>
<Unit type="District" number="254">
<Employee name="Rosie Worcester" unitType="Store" unitNum="2369" reviewStatus="Pending" empNum="26358"></Employee>
<Employee name="George Washington" unitType="Area" unitNum="254" reviewStatus="Pending" empNum="95682"></Employee>
</Unit>
</root>
I need an asp:Label within the repeater to load the <Unit> type and number and then pass the employee information to the gridview. Any suggestions on how I might do this? I cannot directly access the Gridview or SQLDataSource within the Repeater_ItemDataBound event.
Thanks in advance!!
K. Garl
|
|
|
|
|
I have a dateTimePicker control on my form and I am working on a payroll entry form. I want the datetimepicker to default to the following sunday for the period ending date, if the user selects a day during the week. does anyone have any suggestions on how i could do this using the ValueChanged event?
Thanks
|
|
|
|
|
DateTime dt=DateTimePicker.Value;
dt=dt.AddDays((7-dt.DayOfWeek)%7);
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
That worked wonders, I can even use the same logic to grab the beginning of the week.
Thanks
|
|
|
|
|
Hi all!
I have a class like this:
class A<br />
{<br />
private string strA;<br />
private B mySubclass = new B();<br />
...<br />
<br />
class B<br />
{<br />
public B()<br />
{<br />
string strB = strA
}<br />
}<br />
}
Is there a way to make strA visible only for class B and not for other classes? If not can you suggest a workaround to do that?
Thank you.
Luca
|
|
|
|
|
You could... pass a reference to your strA to class B through its constructor.
Or, you could probably do something with delegates. I must check up on delegates one day.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
Thank you! I thought to do that too. It seems to be the simplest way to obtain that I asked
Hope that helps!
Luca
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks!
|
|
|
|
|
If it actually was a subclass, you could just make the string protected.
As B is not a subclass at all, you can't do that. You have to pass a reference to the instance of the class.
Experience is the sum of all the mistakes you have done.
|
|
|
|