|
hi
thanx 4 u r help this fixe the problem . but i have a new problem now which is :
when i click the button 4 the first time the row will be added to the datagrid and i can C it but when i click the button again nothing happen and no data added to the data grid ?!!! any idea ? ? ? ?
|
|
|
|
|
Having quickly looked at the code.. I changed the following:
1) You don't want to clone the dataset since you won't be updating the one that is linked to the control.
Change the line
this.DS= addRCDataSet.Clone();
to
this.DS= addRCDataSet;
2) I modified the whole button1_click() method to:
private void button1_Click(object sender, System.EventArgs e)
{
object[] values = new object[1];
values[0] = textBox1.Text;
DS.Tables["test"].Rows.Add(values);
}
This just seemed a lot simpler to me - your earlier method was giving me problems.
|
|
|
|
|
It would be good to know which line of your code produces the error.
Anyway, by the given error message it's obvious that you try to use an object which wasn't instanciated yet.
So look which line causes the error and verify if you instanciated every object used there.
www.troschuetz.de
|
|
|
|
|
hi
i solve that problem but a new problem occure :
when i click the button 4 the first time the row will be added to the datagrid and i can C it but when i click the button again nothing happen and no data added to the data grid ?!!! any idea ? ? ? ?
|
|
|
|
|
Is there any chance in .NET to override standard look of Windows’ scroll bars (i.e. to make them be flat, change colors…) and then to attach them to standard controls: listbox, combobox, listview? Can I make my own scroll bar and attach it to mentioned controls?
|
|
|
|
|
Did you manage to solve your query? Because I would like to do the same! Please let me know!
Many thanks,
Richard
|
|
|
|
|
Hi...newbie here...yes it smells like an assignment but please if anyone can help with a formula on how to get this one.
My head is spinning....i've only got the inputs and im suppose to create a function not use the ones in the standard library.......pleasssse help with anything...................something......
^^^^^^^^^^^^^^^^
Write a function that takes the time as three integer arguments (hours, minutes and seconds) and returns the number of seconds since the last time the clock “struck 12.” Use this function in a program to calculate the amount of time in seconds between two times, both of which are within one 12-hour cycle of the clock.
|
|
|
|
|
Assuming you're only using 12 hour clocks and not 24 hour:
return (hour*60*60) + (minute*60) + second;
If my assumption is incorrect then you simply need to subtract 12 from hour if hour >= 12.
As for the second part - call the function twice and then take the absolute value of the difference of the two times.
|
|
|
|
|
Simply use the modulus operator to correct the hours value: (hour % 12)
The rest was already given by the previous post.
www.troschuetz.de
|
|
|
|
|
this is what i got...can anyone help integrating the formula suggested into this.........?
to make it simpler.....?
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int time(int,int,int);
int h,h2; // 0-23
int m,m2; // 0-59
int s,s2; // 0 -59
cout <<"Please enter 2 times: "<<endl;
cout<<"enter="" hour="" for="" the="" 1st="" time:="" "<<endl;
="" cin="">> h;
cout <<"enter minute for the 1st time: "<<endl;
cin="">> m;
cout <<"enter seconds for the 1st time : "<<endl;
cin="">> s;
cout <<"Please enter the 2nd time: "<<endl;
cout<<"enter="" hour="" for="" the="" 2nd="" time:="" "<<endl;
="" cin="">> h2;
cout <<"enter minute for the 2nd time: "<<endl;
cin="">> m2;
cout <<"enter seconds for the 2nd time : "<<endl;
cin="">> s2;
cout <<"According to the times entered,"<< endl;
cout<<"the difference between the two times in seconds is "<<time(h,m,s)- time(h2,m2,s2)
="" <<"="" seconds."<<="" endl;
="" return="" 0;
}
int="" time(int="" hh,int="" mm,int="" ss)
{
="" int="" min="0,sec" =0,sec2="0;
" if="" (hh="">12)
min = hh * 60;
sec = min * 60; //converts hours to seconds
if (mm>0)
sec2 = mm * 60; //converts minutes to seconds
int x = sec + sec2+ss; //total seconds
return x; //returns total seconds
|
|
|
|
|
Hi newbie,
Well this sounds like a mathematical function that you would have to make something like -
public int returnSecondsSinceTwelve(int hour, int minute, int second)
{
int timeSinceTwelve = 0;
if(hour > 12)
{
timeSinceTwelve = hour - 12;
}
else if(hour < 12)
{
timeSinceTwelve = hour;
}
timeSinceTwelve = timeSinceTwelve * 60 * 60;
minute = minute * 60;
return timeSinceTwelve + minute + second;
}
i havent tried this function so i dont gaurantee that it will work (i just wrote it roughly and really quick) but the basic theory is - to get seconds out of an hour multiply it by 60 (minutes) and then again by 60 (seconds) - to get seconds out of an minute multiply it by 60. Then add these all up (including second which is already in the right format) and you will get the total seconds. Hope this clears thins up.
|
|
|
|
|
Hi,
Does itextSharp support editing an existing pdf file.
We have a pdf template file with placeholders for different values that needs to be replaced with the actuals programmatically.
Basically kind of "Find and Replace" text values.Is this possible by itextSharp from sourceforget.net or any other pdf writer/generators.
TIA
|
|
|
|
|
If you have questions specific to a particular product, then you need to ask on it's respective site. SourceForge has forums for each projects, so go to the iTextSharp project page and click on "Forums".
If that doesn't do what you need it to, there is another article on this site I just read the other day that may: A PDF Forms Parser[^]. There may be others as well, but you just need to search.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
iTextSharp does not provide an option to EDIT an existing pdf file.
Here is a quote from their tutorial:
You can't 'parse' an existing PDF file using iText, you can only 'read' it page per page.
What does this mean?
The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using these strings. There are probably a number of lines drawn, but you can't retrieve a Table-object based on these lines. In short: parsing the content of a PDF-file is NOT POSSIBLE with iText. Post your question on the newsgroup news:
Also,
What iText DOES provide is the possibility to READ a PDF document and copy an entire page of this file into the PDF file you are constructing from scratch. This can be useful if you want to create a new document based on (an) existing document(s). You can add a Watermark, pagenumbers,...
You may want to check out http://itextsharp.sourceforge.net/tutorial/ch01.html[^]
Jon G
www.Gizmocoder.com
|
|
|
|
|
please show me how to do an ecommerce page.
Thank in advance.
Thanks
Rock Throught The Night
|
|
|
|
|
|
Hi,
I would like to edit a Excel TextBox using C#. I have done the selection using the following code:
((Excel.Shape)xa.ActiveWorkbook.ActiveSheet).Select("txtViews");
Next I want to edit the text in the TextBox. How do I do that? Any help would be highly appreciated.
Thanks,
Manish
|
|
|
|
|
I'm trying to pick out individual cells in an xml document that has been created from an excel spreadsheet. The problem is that when a cell value is missing in the spreadsheet xml does not add a null value node to take the place of this, thus putting the xml out of synch - that is, what should be the 5th node in a row is now the 4th.
Does anybody know how to get around this? The only thing I can see extra in the xml is a new attribute ss:Index="5" for the cell after the one that has been missed.
wend
|
|
|
|
|
Use the attribute, then. Since you obviously already know the number of cells that should exist, you can author your loop so that if the ss:Index qualified attribute (don't forget about the XmlNamespaceManager ) does not equal the current index in your loop, use continue (or just don't execute code a la your condition).
If you feel this is problematic, I suggest posting to the appropriate Office newsgroups on news://msnews.microsoft.com. Microsoft developers keep an eye on those and a discussion may already exist about that problem since I doubt it's uncommon.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Anyone recommend a good component to sync a sql database to Outlook's contacts/tasks/events? Intellisync looks great, but $50K(!) is a bit steep.
Thanks!
Chris
|
|
|
|
|
This forum is for questions regarding C#. You might try and lounge.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I'm trying to access C# object as COM object in C++ and I generate TLB file and use
#import in C++, but I'm having a bit of problems with return types.
For example if have method:
string GetValue()
the generated interface (*.tlh file) gets translated to:
virtual HRESULT __stdcall GetValue (/*[out,retval]*/ BSTR * pRetVal ) = 0;
the return argument always gets put as last parameter.
All the example I've seen (in books or MSDN) do not do that. They always return whatever is returned.
Is there maybe some attribute I have to apply? I'm using VS2005, so maybe it's new behaviour there?
Thanks.
|
|
|
|
|
This is the documented and expected behavior. All COM methods (and, by extension, properties) are supposed to return HRESULT s (as yours does), and what COM clients like VB and .NET via COM interop see is return values (although in .NET you can attribute your methods with PreserveSigAttribute - among other ways - to make sure an HRESULT is returned as an Int32 since the return result code might be important and may not be an error (like S_FALSE ).
I recomend that you read Creating a CCW for COM enabled non .NET applications[^] here on CodeProject, as well as Exposing .NET Framework Components to COM[^]. Make sure that you hard-code GUIDs with the GuidAttribute and never change published interfaces (i.e., interfaces you've released unto the world). Always derive new ones. Also never use auto-generated class interfaces. Define your interfaces explicitly and implement your class interface as the first interface in your implementation list.
Also, what examples are you looking at? I've read about every article and API doc in MSDN and COM methods are all return HRESULT s or SCODE s (legacy) - it's part of the COM spec to do so. VB (pre-.NET) interprets [retval] s as return values, just like tlbimp.exe and VS.NET do when importing a typelib. Other late-bound clients like Windows Script (VBScript, JScript) do so as well.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
You're actually supposed to use the PreserveSigAttribute when you do this. Some times the samples are incorrect. Try compiling the following:
using System;
using System.Runtime.InteropServices;
[assembly: ComVisible(true)]
[assembly: Guid("519a4822-f224-47fa-bdc7-8037829365dc")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("f9b77b61-b4f0-4be4-9c53-ded9592e90c6")]
public interface ITest
{
[DispId(0)]
int Foo(string value);
}
[ClassInterface(ClassInterfaceType.None)]
[Guid("ae5e53c8-54d6-4667-9396-582f5c8611bf")]
public class Test
{
public int Foo(string value)
{
return value.Length;
}
} Compile using:
csc.exe /t:library test.cs Next, register the library and generate a typelib:
regasm.exe /tlb test.dll Finally, view the typelib:
oleview.exe test.tlb You'll see the following:
[
uuid(519A4822-F224-47FA-BDC7-8037829365DC),
version(1.0),
custom(90883F05-3D28-11D2-8F17-00A0C9A6186D, Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
]
library Test
{
importlib("mscorlib.tlb");
importlib("stdole2.tlb");
interface ITest;
[
odl,
uuid(F9B77B61-B4F0-4BE4-9C53-DED9592E90C6),
version(1.0),
dual,
oleautomation,
custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, ITest)
]
interface ITest : IDispatch {
[id(00000000), propget,
custom(54FC8F55-38DE-4703-9C4E-250351302B1C, 1)]
HRESULT Foo(
[in] BSTR value,
[out, retval] long* pRetVal);
};
[
uuid(AE5E53C8-54D6-4667-9396-582F5C8611BF),
version(1.0),
custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, Test)
]
coclass Test {
[default] interface _Object;
};
}; If you used PreserveSigAttribute , then it would simply be HRESULT Foo(BSTR value) .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|