|
Thanks Tom, this gives me a lot of openings!
Greetings,
Dreeke
|
|
|
|
|
Hi,
i'd like to know if there's a property to cause the scroll bar in
the listview to always be down,
"autoscroll" Like whenever a new item is added the scroll bar goes with the new item
ant Suggestions??
THANKS
Have Fun
Never forget it
|
|
|
|
|
hello
horizontal scroll bar is thr for the list view
use the Expandall(),Collapseall().... properties of the listview to avoid the vertical scroll bar
thanks
|
|
|
|
|
Do you mean that you want the list view to automatically scroll to the item you've just added? If so, you need to use the following code:
<br />
ListViewItem lv = this.listView1.Items.Add(new ListViewItem("new item"));<br />
lv.Selected = true;<br />
lv.Focused = true;<br />
listView1.TopItem = lv;<br />
HTH
It definitely isn't definatley
|
|
|
|
|
Hi all,
I have three radio buttons in a GroupBox. I want to find the selected radio button there. I've done the following.
<br />
int _select;<br />
<br />
if(rb1.Checked)<br />
_select = 0;<br />
and so on. Seems it's not a good practice at all, say I have 10 radio buttons. Can someone suggest a better way to do this.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
use RadioButton class as array and use ".Checked" accordingly with every radionbutton instance in a loop. e.g after creating array instance
if(radioButton[i].Checked)
_select=0;
Thanks,
Chintan(India)
|
|
|
|
|
AFAIK, Windows forms don't have a RadioButtonList control. So I think there is no better way than what you are doing.
|
|
|
|
|
How about that way that Chintan.Desai talking.
I'll give a try and seems it's working fine.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
If the radiobuttons are in a groupbox, then use GroupBox.Controls property to loop through.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
using a panel can work where a groupbox isn't appropriate.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
That is OK. But AFAIK, you won't get design time support for control arrays in C#. You need to edit the designer generated code to make the radio buttons in an array or write your own code to add it to the form.
|
|
|
|
|
The story behind this question is simple: I'm trying to build a serializer that serializes a generic class into a custom format.
public class NGConfigUnit<t>
{
protected T _value;
.........
.......
public T Value
{
get
{
return _value;
}
set
{
_value = value;
_isDirty = true;
}
}
}
Problem is that when I access the class via reflection the values are returned as object.
Even though I can check the value of T using reflection and generate an instance using a factory, I cannot reference a generic instance dynamically i.e. I cannot write something like (no support for this C#):
NGConfigUnit<typeof(myval> unit = .....
This blocks me from accessing fields and properties explicitly, which is crucial for the rest of my code.
Any idea how to reach am alternative?
Thanks,
Omer
|
|
|
|
|
You are probably getting a version mismatch.
Try running the scenario WITHOUT rebuilding you project.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I'm afraid my question was not understood.
The generic parameter type to be returned by reflection is known only at runtime, so I cannot write in my code something like:
NGConfigUnit<double> unit = fieldInfo.GetValue(obj, null) ..... - I simply don't know if the value returned shall be NGConfigUnit<double> or NGConfigUnit<int> or whatever ...
So what I need is a way to invoke NGConfigUnit<t> methods not using reflection and w/o knowing what T is in advance. I doubt if there's such a way, but suggestions are welcomed.
Thanks,
Omer
|
|
|
|
|
Hi all,
I look 5 event log type in window event log. They are as under.
<br />
error.<br />
information.<br />
warning.<br />
success audit.<br />
failure audit.<br />
While, my requirement is to add 2 more custom event log type, along with it...such as
<br />
FATAL.<br />
DEBUG. <br />
Can any one advice me, how to do it...(PROGRAMATICALLY)
thax in advance.
Thanks,
Chintan(India)
modified on Wednesday, December 10, 2008 3:53 AM
|
|
|
|
|
windows application using c#...
i have 500 records in my table....
i have to the records in multiples of 50...
how can i do this...
send me sugesstion or samp coding...
|
|
|
|
|
With paging, I guess. You can page by requesting 50 records at a time from the DB, or by asking the control to page the full dataset for you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Use datagrid with paging and set the max records for a page 50.get the records from DB put it in dataset or Datatable bind it to grid with paging
Cheers!!
Brij
|
|
|
|
|
// Exception Handling
using System;
using Students;
public class ExceptionHandling {
static void Main(){
// We declare two students object references, but only instantiate one
// Student object; s2 is given a value of null, indicating that it
// isn't presently holding onto any object.
student s1 = new student();
student s2 = null;
// Exception handling is now in place.
try {
Console.WriteLine("Initializing students....");
// this line executes without throwing exception.
s1.Name = "Fred";
// This next line of code throws a NullReferenceException at run time because
// s2 was never initialized to refer to an actual Student object ...
s2.Name = "Mary";
// ... and as soon as the exception is detected by the runtime, execution
// jumps out of the try block -- none of the remaining code in
// this try block will be executed -- and into the first catch block
// below that is found to match a NullReferenceException, if any.
s1.Major = "MATH";
S2.Major = "SCIENCE";
Console.WriteLine("Initialization successfully completed.");
} // end of try block
//Pseudocode.
catch (UnrelatedExceptionType e1) {
// exception handing code fo this type of (hypothetical) exception
// goes here ... but, since our example doesn't involve throwing this
// particular type of exception at run time, this catch block will be
// skipped over without being executed.
Console.WriteLine("UnrelatedExceptionType was detected ...");
} // end of catch (UnrelatedExceptionType e1)
catch (NullReferenceException e2) {
// Here where we place the code for what the program should do if
// a null reference ws detected at run time.
Console.WriteLine("Whoops -- we forgot to initialize all of the students!");
} // end of catch (NullReference Exception e2)
finally {
// This code gets executed whether or not an exception occured; that is,
// whether we made it through the try block without any exceptions being
// thrown, or whether one of the catch blocks was triggered.
Console.WriteLine("Finally");
} // end of finally
// After the finally block executes, control transfers to the
// line of code immediately following block.
Console.WriteLine("Continuing along our merry way ...");
}
}
// This class has the simple name "Student".
using System;
namespace Students
{
public class student {
private string name;
private string major;
public string Name {
get{
return name;
}
set {
name = value;
}
}
public string Major {
get{
return name;
}
set {
major = value;
}
}
}
}
|
|
|
|
|
Well, at first glance, I am not sure why you have your class in a namespace and your main method seems to not be in a namespace. Does that even compile ? If it does, it looks like this will work, if by work you mean to show how a null reference exception works. What is the question/issue ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thank you for answering. I was not sure, I thought you need to initialize namespace for class. However, in main method you link the programmer-define namespace with "using".
|
|
|
|
|
What do you mean 'you' ? You wrote this code, right ? I didn't. Or do you mean it generically ? Are you asking about code you wrote, or code you found somewhere ? What's the question ? Does the code work ? It looks to me like it should. 'using' is all you need to automatically scope an entire namespace. You don't initialise a namespace, that's not possible at all.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I wrote the code. I meant generically, looking for a suggestion, how would you handle this particular case. The code works fine.
I appreciate your help.
|
|
|
|
|
hello all
i want to set up a serial port communication thru the C# application in which the data from the system (the application) would send the data to the microcontroller. the Microcontroller is having the UART interface to accept and send data i believe...
How is this achieved thru C#.net...
Socket programming || Serial port Programming
i awit for u r valuable suggestions
Thanks
|
|
|
|
|
This[^] is the best reply I have ever seen for your question. Please don't repost.
|
|
|
|