|
I can save a date but not a time like 11:01 any ideas, the grid is bound to a wizard generated dataset
Thanks for any help
jnc
|
|
|
|
|
How do you mean you can't save time? Explain!
|
|
|
|
|
Many thanks for your reply
I have a test app with a bound grid a number of columns two are Time
I have a seperate routine which defines the columns of the grid
for the relevant column
DataGridTableStyle ItemList= new DataGridTableStyle();
ItemList.MappingName="TblEventitems";
DataGridTextBoxColumn Col3=new DataGridTextBoxColumn ();
Col3.Headertext="Start";
Col3.MappingName="EIStart";
Col3.Format="HH:mm";
Col3.NullText="00:00";
Col3.Width=50;
Col3.Alignment=HorizontalAlignment.Center;
ItemList.GridColumnStyles.Add(Col3);
DataGrid1.TableStyles.Add(ItemList);
other columns save OK even for the same record but the time remains 00:00 I have tried removing the NullText format
The Date saves OK (which I don't need) but the time is 00:00 If I change the time directly in the table it displays Ok in the grid but then I get a Concurrency Violation if I try to update
|
|
|
|
|
hi,
You can show time on your datagrid. For more details view this site
datagrid in codeproject
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi...
I have made a RichTextBox and wants to save the text...!
but it keep throws an error..!
My code is like this...
RichTextBox TextTest = new RichTextBox();
TextTest.Multiline = true;
TextTest.Text = "Test on savint" + "\n";
TextTest.Text += "here is something" + "\n";
TextTest.Text += "And some more" + "\n";
Stream TextSave;
SaveFileDialog spil = new SaveFileDialog();
spil.Filter = "TXT fil|*.txt|Alle filer|*.*";
spil.Title = "Gem fil som tekstfil";
spil.InitialDirectory = Directory.GetCurrentDirectory();
if(spil.ShowDialog() == DialogResult.OK)
{
if((TextSave= spil.OpenFile()) != null)
{
TextTest.SaveFile(TextSave, RichTextBoxStreamType.PlainText);
TextSave.Close();
}
}
But it trows an errer -> System.NullReferenceException: Object no set to an instance of an object!
Can anyone help me what to do?
QzRz
|
|
|
|
|
QzRz wrote:
But it trows an errer -> System.NullReferenceException: Object no set to an instance of an object!
At what line>?
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi.. sorry i didnt write...
The error is thrown here -> TextTest.SaveFile(TextSave, RichTextBoxStreamType.PlainText);
QzRz
|
|
|
|
|
You haven't initialized TextSave
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
Doh...! I forgot that...!
Thanks alot..!
QzRz
|
|
|
|
|
You could ged rid of the Stream TextSave and use
if(spil.ShowDialog() == DialogResult.OK)
{
TextTest.SaveFile(spil.Filename, RichTextBoxStreamType.PlainText);
} instead.
|
|
|
|
|
Hi
I have a untyped dataset and also a typed dataset on my design surface. To add new tables to my untyped dataset I can go thru' Tables collection in properties window. But it's a tedious job. Can I somehow copy the structure of table from Typed Dataset(which have been generated using DataAdapter) into Untyped one?
|
|
|
|
|
Can you explain yourself. What are you trying to do this for?
|
|
|
|
|
hi,
can any one tell me how to translate gregorian date to hebrew date?
thanks in advance
|
|
|
|
|
|
Here is one of the coolest few lines of code to perform a NSLookUp. Simply enter an IP in textBox1, click a button and the domain name translates in textBox2 (providing your workstation is on a WAN.
Q. How could we build a 'cache' to capture redundant IP's/Domain's to add lookup performance???
Q. How could we add our own know IP's/Domain's to this 'cache' ??? (Because NOT every IP will resolve)
Preferably the code would check our personal 'cache' first before looking on the Internet or elsewhere.....
public void ButtonLookupDomain_Click(object sender, EventArgs ea)
{
IPHostEntry IP = Dns.Resolve(textBox1.Text);
txtBox2.Text = IP.HostName;
}
|
|
|
|
|
if (somehashtable.Contains(textBox1.Text))
{
txtBox2.Text = (somehashtable[textBox1.Text] as IPHostEntry).HostName;
}
else
{
IPHostEntry IP = Dns.Resolve(textBox1.Text);
txtBox2.Text = IP.HostName;
somehashtable[textBox1.Text] = IP;
}
top secret xacc-ide 0.0.1
|
|
|
|
|
Excellent, clean and simple coding. I like it so far... The more I study windows DNS, I realize my goal is to create my own 'hosts' file. I can write to it and IPHostEntry can read from it instead of the 'hashtable' you've so kindly shared.
Q. How can I create my own 'hosts' file in place of the 'hashtable' example???
Thank You.....
|
|
|
|
|
kvnsdr wrote:
The more I study windows DNS, I realize my goal is to create my own 'hosts' file.
DNS was made to remove the need for HOSTS file. Heck you can even just edit the windows one then (i do for my little local network) in $windir\system32\drivers\etc\hosts
top secret xacc-ide 0.0.1
|
|
|
|
|
can someone suggest which xml class i should use to easily find a certain, possibly nested, element tag and read its value? i've been playing with the xmltextreader class but it's not immediately obvious how to do it with this class. i'm not well versed in XML vocab, so this might be a problem. thanks for any help.
|
|
|
|
|
You should look into xpath expressions - they are a spacialized xml querying language, precisely for what you are trying to do.
my blog
|
|
|
|
|
A shorter answer would be to the question, "What XML classes can't I use to parse and read values from XML files?"
Take a look at the System.Xml namespace in the .NET Framework SDK at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemXml.asp[^]. It's also installed locally by default when you install the .NET Framework SDK or Visual Studio .NET (any version), which also installs the .NET Framework SDK. There's plenty of articles that describe this on MSDN Online[^] (it seems that not a week goes by without another XML article), and there is a great section on working with XML in the .NET Framework SDK. Read Employing XML in the .NET Framework[^].
Notice how much I mentioned the .NET Framework SDK? It really should be your first place to look and you should definitely read over the programming topics to gain a better understanding of what's available in the .NET Framework base class libraries, as well as the CLR and other .NET technologies themselves.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Just wondering about something: In the old c++ days we used to make com components that could be called in something like a Word Macro script (Visual Basic for Applications) or in Microsoft Access by adding a reference to it in VBA code behind a form etc.
This brought real value to our apps for end-users comfortable with working in VBA, not only could hard-core developers use our business objects, but relatively casual end-users could as well. This seems to be something we might have to give up for our .net based apps.
We have a business object library written in C# that compiles into a .net assembly that can be used by programmers in c#, VB.net etc etc, is there any method to expose that same functionality for VBA macro people?
(I've found some references to "VSA" that seemed to be in the neighborhood of what I'm thinking of, but those references are very old (circa 2001, 2002) and many different ones claim that VSA is a dead-end project by Microsoft that is flawed and being deprecated.)
On another tack entirely, if the above is possible, is it then not also possible to add VBA scripting ability to our own c# Windows Form app that consumes our business object library so that users could create their own macros and "run" them in our app. Kinda like in Word you can create a document or you can run a macro to create a document etc.
I've researched this but seem to get stuck on the fundamentals, any ideas / links would be greatly appreciated.
An election is nothing more than the advanced auction of stolen goods.<br />
- Ambrose Bierce<br />
|
|
|
|
|
You should read Exposing .NET Framework Components to COM[^] in the .NET Framework SDK which describes how to expose them to COM. What you won't read about is that you never use auto-generated class interfaces (use ClassInterfaceType.None for the ClassInterfaceAttribute and implement the interface you declared explicitly as the first interface in the list for your COM "coclass"), and always use the GuidAttribute for your assembly (for the typelib ID), your classes (the CLSID for the ones you expose to COM, and your interfaces (the IID). Never change a published interface - always derive from it a new one and implement that as the class interface (or another implemented interface) on the class.
Basically, if you've done COM development (and I don't mean in VB) you've got a pretty good feel for the guidelines. Following them is just as important in the .NET Framework.
Using these concepts, you could actually script your .NET Framework application. You'll need to P/Invoke quite a bit to bootstrap the VBA runtime and provide it the information it requires, but nothing that's too hard. Read Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK, and be sure to read about marshalling for both COM interop and P/Invoke in Interop Marshaling[^]. Understanding both unmanaged and managed data types (like that an unmanaged long is a managed int since both are 32 bits) is important.
There is another way, though. You can let users "script" with managed languages like C# and VB.NET. It's not actually scripting because it's not late-bound like other script languages, but you can write your script and generate an assembly from it. If you design your interface well enough, you could pass some root object (like the Application object in an object model to be scripted, like the Microsoft Office products among many other apps) to the class that encapsulates the user's "script" (the class template you define). Read Generating and Compiling Source Code Dynamically in Multiple Languages[^] in the .NET Framework SDK, and search here at CodeProject for several examples of "engines" (the true engine is the CLR and CodeDom) that use this concept.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Thank you Heath, if you were here I'd show my appreciation with a beer or beverage of your choice and nice barbecued (charcoal not propane) rib steak and some tasty sweet barbecued corn to go with it.
I really needed a starting point and you've given me more than one.
I had a sneaking suspicion (hope?) there was something beyond COM to do this, but it appears it's back to good old COM again which at least is familiar territory.
Cheers!
An election is nothing more than the advanced auction of stolen goods.<br />
- Ambrose Bierce<br />
|
|
|
|
|
I'll send you an example of a C# dll I created for use in FoxPro, which exposes a SHA method to COM. It'll be in your mailbox tomorrow.
Exposing C# to COM is fairly easy. For your last question, there's an article somewhere here on CP that enables your app to have some scripting capability, although I can't seemm to find it...
|
|
|
|