|
Brad Wick wrote: I have a function that I would like it to return the information in an array or something like it, but I can't figure out how to add the data.
If you can't figure out how to add data to an array then I suggest you get a beginners book. Look for book reviews here on the site.
led mike
|
|
|
|
|
Adding items to an array I can do, but not a Multidimensional Array. Some people do not read books, but search the internet and learn from each time they tackle something. I have been playing around in C# for some time and can do pretty much anything that is needed, but trying to learn some other items. Why dont you just respond to every post "go buy a book" that is so much more helpful then actually helping someone out.
|
|
|
|
|
Brad Wick wrote: Some people do not read books, but search the internet and learn from each time they tackle something.
Ok, good luck.
led mike
|
|
|
|
|
Just look at your XML examples (hierarchy). It's just a name/value pair array.
|
|
|
|
|
So you think it would be better to store the information in XML to pass between different functions/objects?
|
|
|
|
|
No. I don't know your application so it's hard to say what's better. What I was getting at was that if you're confused about multi-dimensional arrays, just look at your XML to visualize what it would look like.
In 2.0 forward, you could use a generic list, but I think you said you're using 1.0+
[Edit] No, the 1.0 was from another question. Sorry.
|
|
|
|
|
The way I normally handle this is to create a class (or struct if more appropriate) for a single item, then create a class that is a generic list of single items.
e.g.
public class MyMessage
{
}
using System.Collections.Generic;
public class MyMessageCollection : List<MyMessage>
{
public MyMessage FindItemFromID(int id)
{
MyMessage found = this.Find(c => c.ID == id);
return found != null ? found : new MyMessage();
}
}
Dave
|
|
|
|
|
Note: This method is new in the .NET Framework version 2.0. and I am using .NET Framework version 2.0.50727.
http://msdn.microsoft.com/en-us/library/1ffy6686(VS.80).aspx
Array.Resize(ref m_yData, m_points);
I get this compile error message "'System.Array' does not contain a definition for 'Resize'".....What am I missing or doing wrong?
Thanks
|
|
|
|
|
C++NewBe wrote: What am I missing or doing wrong?
It's a Generic method so you need a type initializer. The example code in the documentation appears to be wrong also.
int[] ints = { 1, 2, 3 };
Array.Resize<int>(ref ints, 5);
led mike
|
|
|
|
|
You don't need to specify the generic type for a generic method call - you can do this, but in most cases the compiler is smart enough to figure it out. Explicitly specifying the generic type in a method call is only necessary in ambiguous cases where the compiler can't compute the type.
e.g.,
Array.Resize(ref ints, 5);
will work just fine.
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
David Anton wrote: You don't need to specify the generic type for a generic method call - you can do this, but in most cases the compiler is smart enough to figure it out. Explicitly specifying the generic type in a method call is only necessary in ambiguous cases where the compiler can't compute the type.
Sweet. Missed that one and it makes a huge difference.
led mike
|
|
|
|
|
Use a collection instead of an arraylist. Then you don't have to resize manually.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I use sql 2005 along with DAAB using asp.net (c#.Net)
But when i attempt to run the app, i got this error " Instance Failure".
How do I resolve this and what could be responsible.
Thanks
|
|
|
|
|
Banjo Ayorinde wrote: How do I resolve this
I would start by debugging
led mike
|
|
|
|
|
I want to make a transaction/entry in Microsoft Office Accounting 2007/2008 using C#.Net Application. Please give any idea about it.
|
|
|
|
|
dinker batra wrote: Please give any idea about it.
Are you an experienced software developer? If not get beginners books on Computer Science and Software Logic and Design.
Are you an experienced C# developer? If not get a beginners book on C# and .NET
Have you searched for any programming interface documentation for Microsoft Office Accounting? If not I recommend using Google and start every search phrase you try with MSDN , so an example would be: MSDN Office Accounting Object Model
led mike
|
|
|
|
|
|
HI,
I want to create a program so that I can determine if my website is down or up using C#.
Can any one give me an idea where to start. Any idea is greatly appreciated.
Thanks
Pavel
|
|
|
|
|
mdpavel wrote: Can any one give me an idea where to start.
class Program
{
static void Main(string[] args)
{
}
}
led mike
|
|
|
|
|
Vague question, but you can use tcpclient to extrapolate the status.
Namespace: System.Net.Sockets
|
|
|
|
|
Thanks Bert.
What I meant is "is there any way I can ping a website and know the status of the site?.Or anything else I can call that will tell me the status of the website(if it's up or down)?"
|
|
|
|
|
I would use tcpclient connect instead of a ping.
A ping to an ip address could just means it's responding (e.g a router) but doesn't mean the server is really active.
Connecting to an address/port/content means the server is serving content back to your client, so it's active and available.
|
|
|
|
|
hi
i want to set transparented gif images to my pictureBox, in code project, i found som article that write some methods and techniques to set transparent, like this (this is my code):
string gifPath = @"E:\Tutorial\FullComponent\Ajax Loader\ajax-loader.gif";<br />
Image gifImage = Image.FromFile(gifPath);<br />
Bitmap bm = new Bitmap(gifImage.Width, gifImage.Height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);<br />
<br />
System.Drawing.Imaging.ColorPalette pal = bm.Palette;<br />
for (int i = 0; i < pal.Entries.Length; i++)<br />
{<br />
Color col = pal.Entries[i];<br />
pal.Entries[i] = Color.FromArgb(0, col.R, col.G, col.B);<br />
}<br />
bm.Palette = pal;<br />
<br />
BitmapData src = ((Bitmap)gifImage).LockBits(new Rectangle(0, 0, gifImage.Width, gifImage.Height), ImageLockMode.ReadOnly, gifImage.PixelFormat);<br />
BitmapData dst = bm.LockBits(new Rectangle(0, 0, bm.Width, bm.Height),<br />
ImageLockMode.WriteOnly, bm.PixelFormat);<br />
<br />
((Bitmap)gifImage).UnlockBits(src);<br />
bm.UnlockBits(dst);<br />
<br />
System.IO.MemoryStream memStream = new System.IO.MemoryStream();<br />
bm.Save(memStream, ImageFormat.Gif); <br />
<br />
Image bitmap = Bitmap.FromStream(memStream);<br />
this.pictureBox1.Image = bitmap;
but in runTime, all of bitmap was removed and my pictureBox nothing display, how to solve my problem ?
thanks
|
|
|
|
|
Hello
I am wondering what the "best" method is to debug a Win - Service. I know about the following two:
1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know)
2) Start the service and then attach a debugger to it. (Better !!)
3) Try to debug the code in "Console - mode"
If anybody out there has any advice on another way to debug a windows service, then please let me know.
Thanking you in advance
ChristiaanS
ChristiaanS
|
|
|
|
|
There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service.
Brent
Brent
|
|
|
|