|
Could somebody give me a hint where I can find some documentation and advice how to handle MS Project 2003 data through programming with .NET and C#
Thanks
|
|
|
|
|
The best place to find the programming information about Office products is in the developer help that can be installed (and is installed if you choose a "Complete" install) with Office. MSDN[^] contains only the object model diagram (no clicketies) and conceptual articles (still good to read, though).
Even though the object model discusses VBA, the same is available in managed languages. VBA depends upon typelibs to provide OLE/COM automation interfaces and related types. This is the same information that VS.NET and the tlbimp.exe utility use to create a Runtime Callable Wrapper (RCW, often called an "interop assembly"). If you have Office XP, you can download the official interop assemblies (Primary Interop Assemblies, or PIAs) from http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en[^]. If you have Office 2003 Professional, these can be installed along with Office (Microsoft .NET Programming Support).
If you want to support older Office versions, use tlbimp.exe (and specify signing options, which is important if you want to install into the GAC) to generate interop assemblies from those products. These will typically work with newer versions of Office products as well since the typelibs are versioned and class interfaces are almost always backward compatible (at least for the basics).
So, just remember that whatever you read about the object model for VB/VBA, it will work in managed code as well using interop assemblies (though sometimes a little extra programming is required...sometimes).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can get all server name oline in network local?
Quoc
|
|
|
|
|
What? Can you please rephrase your question a little more clearly?
If you want to get the remote computer name in an ASP.NET web application (i.e., the requesting machine), use Request.ServerVariables["REMOTE_HOST"] .
If you want to get the name of the computer on which your code is currently running, use Environment.MachineName .
If you want to enumerate the machines on your local network, you can use the System.DirectoryServices to enumerate domain machines or P/Invoke the Network Management APIs which is discussed in several articles here on CodeProject. Try the following search: http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=NetServerEnum[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can get all server name oline in network local?
|
|
|
|
|
I want to create a Listening UDP socket in Async Mode.
here is my code:
private void button7_Click(object sender, System.EventArgs e)
{
sock = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
iep = new IPEndPoint(IPAddress.Any,20100);
sock.Bind(iep);
sock.BeginReceive(data,0,1024,SocketFlags.None,new AsyncCallback(ReceiveData),sock);
}
private void ReceiveData(IAsyncResult iar)
{
Socket remote = (Socket)iar.AsyncState;
int recv = remote.EndReceive(iar);
Console.WriteLine("Recv {0}:",recv);
remote.BeginReceive(data,0,1024,SocketFlags.None,new AsyncCallback(ReceiveData),sock);
}
//////////////////////////////
i want the sock to keep listening.
However, once i send a udp message with UDPClient from another pc, the ReceiveData(IAsyncResult iar) method turns into a loop keeping writeline.
what is wrong ?
|
|
|
|
|
Is it the same data (assuming that you're sending unique data in the UDP datagrams)?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i send the udp datagrams only once using this code:
UdpClient udp = new UdpClient();
byte[] data = new byte[]{0x11,0x22,0x33};
udp.Send(data,3,ip,port);
at the server, Console keep showing this:
recv :16
recv :18
recv :16
recv :16
...
it seems there ocurrs a loop in the ReceiveData(Async iar) method.
i dont know what happened.
|
|
|
|
|
Assuming that the code you posted is the exact same code (people sometimes post sample code that is nothing like their actual code and doesn't contain the problem, so I just have to say it), I see no loop. What I would check out is the other machine's code. Perhaps it's looping infinitely and your client code is working correctly (seeing each UDP packet as it arrives).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank for your help.
While i test my code again, there comes out correct result.
i am confused for my code being not changed at all.
|
|
|
|
|
Hi,
I have a DataSet that has a calculated column (note: DataSet not originally populated by a source file, not that that matters I guess). I want to save the DataSet to an MS Access db file with the DataAdapter (not a problem with no computed columns). The DataAdapter.Update does not calculate the values (too easy!). Can anyone tell me how I could convert/save/copy this calculated column to a column that is not seen as calculated? Any help on this is greatly appreciated (please show code sample as I'm new to programming).
Thanks,
Ron
|
|
|
|
|
You could write the DataSet out to a stream and read it back into a generic (i.e., not typed) DataSet without writing the schema.
For example, les say your typed DataSet is called CustomOrders :
using (MemoryStream ms = new MemoryStream())
{
customOrders1.WriteXml(ms, XmlWriteMode.IgnoreSchema);
ms.Seek(0, SeekOrigin.Begin);
DataSet ds = new DataSet("CustomerOrders");
ds.ReadXml(ms);
oleDbDataAdapter1.Update(ds);
} The column - without the schema - would seem as a normal, non-computed column.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath!
I'll give it a go
Ron
|
|
|
|
|
Im a college student and I need to write a program to enter, modify and display information for a user and give that user an id number. The program is supposed to represent health club operations.
My menu looks like:
1. Enter new member
2. Modify Details
3. Display member information
4. Exit
Within the new member case the user has to put in age, name, weight and a id number. I don't know how i can display the information for a specific member id and then edit it? would i need to make an array of id's? Should i put all the details in a single string? Im a bit stuck!
Any help greatly appreciated
|
|
|
|
|
dan_ta22 wrote:
I don't know how i can display the information for a specific member id and then edit it? would i need to make an array of id's? Should i put all the details in a single string? Im a bit stuck!
First, you need to store data in a convenient format, you can use XML file or database, for example. You have a lot of learning to do if you don't know what is XML or database.
You should definitely not do it with a single string.
My articles and software tools
|
|
|
|
|
Im not studying c-programming, its just part of my electronics advanced diploma. The project needs to be only done within c++ itself. Since we were only lectured on functions,pointers,arrays,strings, and file i/o we have to use these options to create the program.
|
|
|
|
|
Since this is probably a school project, I'm not going to give you specifics. However here are some things to consider in your design:
1) You need to be able to assign a unique ID to each customer
this suggests that you will have an ID tracker (usually a record with
the last ID assigned to a customer.
2) You need to have records and the ability to randomly read
data. This suggests that your using a database (like Access?)
3) The data you need to keep (member info) would be fields within your
database. If you went about keeping everying in a single string,
you'd have a tough time figuring out how to parse out the individual
data pieces (where does one end and the next field begin).
So this suggests that you have a form which exposes the 4 functions with a windowed area to create/display/modify the member info. The member data you listed would just be text boxes that hold the data and labels that tell the user what data they are looking at....
Member ID [ ]
Member Name [ ]
Age [ ]
Height [ ] feet [ ] inches
Weight [ ]
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Thanks for your information because it just reminded me that i can use c++ to create a file and directly write into it the member information and use a id number as the file pointer. The project is part of my advanced diploma in electronics so im not actually studying c++.
Thanks
|
|
|
|
|
I created a windows service using c# and when I try the following:
using System.Web.Mail;
I get this error:
"The type or namespace name 'Mail' does not exist in the class or namespace 'System.Web' (are you missing an assembly reference?)"
Can someone help me decipher this?
What I'm trying to do is basically send an email through a web service using MailMessage and SmtpMail. So if someone knows a better way of doing this I'd appreciate that too
|
|
|
|
|
You need to add a refrence to the System.Web namespace. Are you in visual studio? If so, just right click on 'Refrences' in the Solution Tab thing. Then select it.
/\ |_ E X E GG
|
|
|
|
|
Yup that's it, thanks for the help. I'm a C++/SQL programmer who was rushed into .NET... fun so far though
|
|
|
|
|
Referencing assemblies is akin to binding libraries. If you need a type defined in another assembly, you have to reference it. Just like if you need to call a function or use a class defined in another library, you have to link it.
Hope that helps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I recently stumbled across a huge performance difference involving writing out a large hash table to a file. The hashtable is holding a very simple object called Token, that holds a string value called token and a couple counters. ToString() is overriden for the object to return:
tokenstring [space] counter1 [space] counter2
If I iterate through the values of the hashtable and write it out to a file, it takes around 1 minute and 40 seconds to complete.
Seems a little slow. Here is the weird part. If I iterate through the values of the hashtable and add them to an arraylist and then iterate through the arraylist to write out the values, it takes between 10 and 12 seconds.
The hash table is large, as the file that is written out is 39 Mb where each line is around 18 characters, where each line represents one hash table entry.
Below is some of my test code to clarify the situation if my explanation above has anyone confused. WriteTokensSlow takes about 1 minutes and 40 seconds. WriteTokensFast takes between 10 and 12 seconds.
private void WriteTokensSlow()
{
WriteCollection(tokensHT.Values);
}
private void WriteTokensFast()
{
ArrayList tokenList = new ArrayList(tokensHT.Values);
WriteCollection(tokenList);
}
private void WriteCollection(ICollection collection)
{
using (StreamWriter sw = new StreamWriter(savePath,false))
{
foreach (Token tokenItem in collection)
sw.WriteLine(tokenItem.ToString());
}
}
Can anyone explain why this is happening? Thanks.
|
|
|
|
|
Im stumped! Both operations are O(n) I cant understand why one should take so much longer (if thats the only code).
top secret xacc-ide 0.0.1
|
|
|
|
|
The difference is in the enumerator. The Hashtable.Values property is, of course, an ICollection (which you already know). Hashtable+ValueCollection.GetEnumerator returns a Hashtable+HashtableEnumerator , which is significantly more complex (and hence slower) than the simple ArrayList+ArrayListEnumerator used when you enumerate the ArrayList .
When you create an ArrayList from an ICollection , Array.Copy is used to perform a shallow or deep copy depending on whether the source and destination arrays hold reference or value types. Either way, this operation is much faster than enumerating a collection and is also handled by the runtime itself (native code). For both these reasons, copying the arrays is much faster.
Hope that helps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|