|
Dear Abisodun,
I am new to C# and XML. COuld you please help me with writing 2) and 3) in C #?
Thanks a lot.
G
|
|
|
|
|
You'll have to show us some code.. The Classes are well documented.
|
|
|
|
|
Hi,
I'm struggling with a property grid control.
Here is what I do:
- I display properties associated to a specific object in the property view.
- For each property, I use a specific editor and allows value to be changed in another form. Each property has access to a specific editor which inherits from 'UITypeEditor'.
- In the EditValue method of my editor, I call my form using the 'ShowDialog' method.
Here is the beginning of my EditValue method:
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)<br />
{<br />
string startingPropertyValue = null;
PropertySpec currentPropertySpec = null;<br />
<br />
if (context != null && context.Instance != null && provider != null) <br />
{<br />
editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;<br />
}
My problem is that I'm not able to retrieve the values selected in my second form and display them for each selected property.
Can you help me please ?
Thanks.
Pat.
p.f. Goudjo-Ako
Bringing our energy together !
|
|
|
|
|
Hello developers,
I am kind of stuck.Please if you can help me with the following
How to create a grid at run time in side a for loop?
hence the number of the grids on a page is equals to the number of times a for loop runs.
My data table contains list od "Id"s from users selection using a checkbox.
Ex. for(int i=0;i<=dt.rows.count;i++)
{
execute a stored procedure with Id parameter.
ds.fill(sda);
gridview gv +i=new GridView();
gv+i.datasource=ds.tables[0];
gv+i.bind();
}
Hence the total number of the grid on a page is equal to dt.rows.count
Please advice
What i mean is to create gridviews dynamically on run time based on user input?
Email : Kibrommail@yahoo.com
Thanks
-- modified at 15:56 Tuesday 3rd July, 2007
|
|
|
|
|
Can someone help me!? I know in JavaScript I could use eval() to achieve this but I am not sure how to accomplish the same things in C#. Let's say I had a method in which one of the arguments was a string or any variable for that matter, and based on that variable passed to the method another method of the given name in the variable would run...(see example below), I am just getting into C# and any help with this would be much appreciated...!
public static void RunAMethod(string methodname)
{
methodname(); //method to run
}
///---- so I could do this from another method
RunAMethod("runwhatevermethodIwant");
///-----
Is this possible???
|
|
|
|
|
|
Reflection is way slow. You should consider to use delegates, which are quite similar to C's function pointers. The topic is not very simple, but delegates are very powerful and elegant. Here[^] is an introductory article on MSDN Magazine.
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker
My Blog - My Photos - ScrewTurn Wiki
|
|
|
|
|
Delegates seem very interesting to me also...although I am having a little difficulty visualizing their usage properly from the MSDN article, is there anyway you could write out a little snippet showing how I could use delegates to call a method whose name is based on a string I enter?
Thanks!
|
|
|
|
|
Can you call a delegate with a method name defined in a string?!? Because this seems to be what he wants.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
No. Not directly at least.
The point is that invoking methods at runtime by their name is not very clean, in my opinion. Since I guess the methods he wants to invoke are parameterless and with no return value, using delegates would be very easy and would improve the robustness of the code.
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker
My Blog - My Photos - ScrewTurn Wiki
|
|
|
|
|
I agree with you in the way that he should consider using an interface instead instead of calling a method by a name specified in a string.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Thank you very much for both of your replies, I had a hunch that Reflection might be something I needed to look into, and I'll definitely give it a shot. 
|
|
|
|
|
Is there a way of using a 2D array as a DataSource to controls such as DataGridView or ListBox?
|
|
|
|
|
I seem to recall doing something similar to this with .NET Framework 1.0, or 1.1 (not sure which). I believe I used an ArrayList of ArrayLists for initial data population of the datagrid for a quick test. I never tried manipulating the data of the ArrayList after that. For data manipulation after the initial population I believe I used the native datagrid methods.
|
|
|
|
|
Hi all
At work we have a database that is read only that keeps track of the work we do ( who completed what ticket and so on) I need to take a chunk of the database for the work done by my group then count up certain types of information like who has done how many tickets or how many of one type of problem there was during a certain time.
question 1) can i use the fact that this is read only to my advantage in terms of speed or memory i saw something called sqlreader but i haven't had time to play with it yet
question 2) given the senerio above what would be the most efficient work flow? should i read the database into a dataset then do my filtering from there or something else
unfortunately this is not my strongest subject so all suggestions are appreshated
|
|
|
|
|
I would choose solution 1, coupled with the use of stored procedure. As a piece of advice, if you are only reading from the tables, use the with (nolock) lock hint in your queries.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
since your saying "chunk of data" i would prefer using datasets because..if your using datareaders each time u connect to the database whenever u execute a query..but datasets you can work in disconnected mode..
aneef
|
|
|
|
|
Hi!
I have 2 forms:
Form1 and Form2, how I can write the text of a textbox in Form1 in another textbox in form2?
Thank
Bye.
|
|
|
|
|
There are a lot of ways to do this. The easiest ones are:
- If form B is created by form A, and A has the initiative (e.g. because there is an
event firing in A), let A do the work using a property of B.
- if the initiative is reverse (the slave form B decides when), then the easiest is by
giving it a public event, so the master form A can wire a delegate to it and
un its update method whenever required.
Hope this helps.
|
|
|
|
|
Luc Pattyn wrote: - If form B is created by form A, and A has the initiative (e.g. because there is an
event firing in A), let A do the work using a property of B.
Thaks, but how i can do that?
Any example??
By Windows M
|
|
|
|
|
How does form A change form B's size ? by setting a new value to its Size property.
SImilar for any other property you can imagine (and hence add to a class):
in FormTypeA class:
FormTypeB formB=new FormTypeB();
formB.Show();
...
private void myTextBoxA_TextChanged(object sender, EventArgs e) {
formB.Size=new Size(500, 600);
formB.TextBoxText=myTextBoxA.Text;
}
In FormTypeB class:
public string TextBoxText {
set {
myTextBoxB.Text=value;
}
}
May I suggest you work your way through a general C# book...
|
|
|
|
|
Bind the same datasource to both textboxes. That way a change in one will show up immediately in the other.
|
|
|
|
|
Hi All,
The project i'm working on at the moment needs to draw information on top of a photo. The content of the photo varies massively - the colour and brightness vary a lot.
Can anyone think of a way of colouring the lines and text so that they are visible whatever the background image? and even if a line starts in a bright area and proceeds into a dark area?
My only idea is to use a "negative" approach, but i'm not sure how that can be implemented (easily) in GDI+
Any ideas greatfully received.
Thanks
Jon
|
|
|
|
|
You could probably draw two texts/lines varying the pen width and color, so that each element actually has a small visible outline. For the text, you have to add it to a Path object and use the DrawPath method.
Here you can find some help: http://www.bobpowell.net/faqmain.htm[^]
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker
My Blog - My Photos - ScrewTurn Wiki
|
|
|
|
|
Hi,
I know of no general solution. Here are some ideas though:
- for lines, one could draw two parallel lines in different colors
- for text, use a heavy font (either bold or black) and make it sufficiently large
- or for text, draw text twice, same font, same size, slightly offset (x+2, y+2)
using different colors
- smart color selection: built a histogram on your image (pick 100 pixels, convert them
to hue value, and now choose a color with the opposite hue = add 180 degrees, full
saturation, full brightness (unless histogram shows image is bright, then use black).
- on a display, use blinking (500 msec on/off)
- on a display, let the added info be drawn differently (other color, wider, ...)
while the user holds down CTRL key
Hope this helps
|
|
|
|