|
Christian Graus,Thanks for your kind help,If you know some simple examples for reference,I am very grateful!
|
|
|
|
|
Have a read through the articles on Marc Clifton's blog[^] (or here in Code Project), paying particular attention to his articles on Declarative Programming.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
If your users are WPF-tolerant, then you can use the XamlReader[^] class like they did in this thread on the MSDN forums
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
|
I've searched for some component examples but I couldn't find what I want, it seems to be simple but i'm getting few issues to develop it.
What I would like to have is a custom component inherited from a textbox and also add a Label at runtime. so, everytime I drag & drop the textbox from the toolbox to the form it comes with a label, if i move the textboxcontrol or the label, they all move together.
Is it possible to do it instead of creating a usercontrol?
Thanks in advance!
|
|
|
|
|
Yeah, write the entire thing inheriting from Control instead.
Is there is a way to do it without creating your own control?? Nope.
|
|
|
|
|
I am working on a ultra light database for .NET.
I target small programs where using in memory datatable would be wasting too much memory but using SQL Express would require a too big install.
It could be for example used for example :
- by a client application that want to cache data coming from the server
- by a small programs like a little mp3 library, custom webbrowser to store bookmarks or a list of cached files.
It has a few features that might of interest:
- Very low memory footprint
- Very compact (45 Kb so far)
- Very fast (having no transaction support, no multi-threading support has its benefit)
- Automatic caching mechanism
- Work with garbage collector
- Supports DBF format
- Supports DBF index
There is a little demo program.
I wondered if some of you could have a look.
The program shows you a table of individuals.
The menu let you add 100 random individuals.
The index support is not really implemented well.
Once you have a few hundread you can click on the header to sort by that column, the index is created only once however, I haven't written the BTREE index deletion/update yet.
http://dbfdotnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28087[^]
|
|
|
|
|
If you want opinions, write an article about it, including the source code, of course.
People will let you know what they think.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Pascal, I agree with Henry ... in addition, you could contrast it to for example, using a .NET wrapper over SQLite
'g'
|
|
|
|
|
I agree that you should make this an article. Another idea, which I've been bouncing around in my head, is to write a B+Tree implementation since they key to a small database is the indexing (without that, writing a flat file is very easy.) Yes, a wrapper around something like SQLite is an alternative, but three times in my career I've needed a B+Tree for a temporary index during data importing. I have one half done in C++, but got bored and moved onto other projects.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
Hi all
I’m looking for some assientance on auto initialising all public fields in a class.
I have a class with about 50+ fields. When an instance of the class is created and a value is assigned to the fields, it appends to the existing static value.
MyClass obj = new MyClass();
obj.Example = “THIS_STRING”; // This would therefore return STATIC_BEGINING_OF_STRINGTHIS_STRING which is desired.
My problem is that in obj.allRecords will only contain “STATIC_BEGINING_OF_STRINGTHIS_ STRING” and not “ANOTHER_STATIC_BEGINING_OF_STRING” plus the other 50 fields as they have not been initialised to their initial default value. I dont want to do it manually in the object as the point is that they are in the list as their default value even if unchanged.
Thanks for any help.
class MyClass {
public MyClass() { }
public List<string> allRecords = new List<string>();
private string _example = "STATIC_BEGINING_OF_STRING";
public string Example
{
get { return _example; }
set
{
_example += value;
allRecords.Add(_example);
}
}
private string _recordEnd = "ANOTHER_STATIC_BEGINING_OF_STRING";
public string RecordEnd
{
get { return _recordEnd; }
set
{
_recordEnd += value;
allRecords.Add(_recordEnd);
}
}
}
|
|
|
|
|
I am not exactly sure that I understand what you mean when you say:
tig2810 wrote: I dont want to do it manually in the object
If that means that you don't want to type in the code to add each field to allRecords , then I don't know how to help you.
Otherwise you might consider a static constructor .
Also you might want to consider changing the type of allRecords . Using List<string> means that each time recordEnd is modified, a new entry will be added to allRecords , You might consider a generic Hashtable or Dictionary .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
tig2810 wrote:
I dont want to do it manually in the object
-
If that means that you don't want to type in the code to add each field to allRecords, then I don't know how to help you.
This is my point. I want to type it in the class so it's automattically initialised in the object. I dont want to have to initialise all the fields in the object, but all the values to be already available.
|
|
|
|
|
In that case a static constructor sounds like it would fit the bill.
This is the MS documentation[^]
and
This gives a few more examples[^]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ok great, it sounds like that's the right direction for me. I've been looking and trying it out for a while but i dont see to be able to get it to work. Would you be able to help my showing me an example for the first field?
Thanks for helping. I'm still learning.
|
|
|
|
|
1. You could initialize the properties instead of initializing the fields.
class MyClass
{
public MyClass()
{
Example = "...";
RecordEnd = "...";
}
}
2. You could use reflection in the class's constructor to grab the values of all fields. I don't know if the order of addition to allRecords matters though.
class MyClass
{
public MyClass()
{
var fields = this.GetType().GetFields(...);
foreach(var field in fields)
{
allRecords.Add(field.GetValue(this));
}
}
}
|
|
|
|
|
hi everybody
I want to bind datagridview in runtime and can make column a combobox and another column checkbox and so like in access db
how can i do that
please answer me
|
|
|
|
|
MS has already invested wasted a lot of money in preparing documentation. Why don't you read it?
Wasted, since there are many who just don't look at it.
modified on Sunday, May 31, 2009 2:54 PM
|
|
|
|
|
Hi
Here this code might help you.
DataGridViewColumn col;
col = new DataGridViewComboBoxColumn();
dataGridView1.Columns.Add(col);
col = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(col);
Do reply after trying this.
Satish Pai B
|
|
|
|
|
Hello!
I'm stumped! I've been tring to code up a routine that monitors a parallel port pin for status change, then reads the data coming across it. My unique requirement is that I need to monitor the port more frequently than provided by the usual Sleep or Timer utilities (which have millisecond accuracy). I've developed a microsecond-level Timer to solve that problem, using QueryPerformanceCounter/Frequency. The real problem I have is that by polling the parallel port, the program locks up: "Program Not Responding". I've looked into Port Interrupts, but haven't found much that's intelligible.
What's an easy way to implement what I'm trying to accomplish?
Glen
|
|
|
|
|
You could remove the Program Not Responding problem by doing the polling in another thread. I would be surprised if Windows didn't let you hook into the interrupt for the parallel port; that said, it's understandable why the designers don't want an application being able to sniff every byte being sent through such a port
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Would BackgroundWorker() be appropriate to generate another thred? BTW, I'm using a while-loop to do the polling. With regard to hooking into an interrupt, I've been digging into the documentation, but haven't found anything really useful...
|
|
|
|
|
You could use a BackgroundWorker, yes. But you'd probably find instantiating a Thread would be a little simpler; BackgroundWorker does this behind the scenes anyway
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Sorry it took so long to get back to you - been busy with my "other" job. If I'm polling the port pins [while(look for port pin change)] in a background thread, wouldn't that just still cause the system to not respond?
|
|
|
|