|
Yes but the result is same
|
|
|
|
|
What do you mean the result is same? It happens in the same place? If so, maybe you could help us to help you by posting a relevant code snippet.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
I ran into the same issue after upgrading to Windows 7 (and IIS7) A WCF service that was previously working started to get this error.
To fix, I went into the Build properties of my projects (Project/properties/Build Tab) and changed the Platform Targer to "x86". Then the problem was gone.
|
|
|
|
|
Hello everyone,
I have made some search, but can not find C# samples of using XmlDocument, either from MSDN or other sources.
Any recommended samples?
thanks in advance,
George
|
|
|
|
|
George_George wrote: I have made some search, but can not find C# samples of using XmlDocument, either from MSDN or other sources.
You didn't try very hard then. 5 seconds with Google threw up this[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks pmarfleet!
I like this one. I add an additonal "sample" keyword to do the survey, and do not find as much as you did.
regards,
George
|
|
|
|
|
Can we have an string array and add strings elements to it at random points of time, without using a for loop??
Som
|
|
|
|
|
You can not add element to array. Array has fixed lenght. You can only change any element in array any time:
myArray[0] = "hey bob!";
if you need to add element to array you need to create a new array(with more elements) and copy elements from old arrray to it together with you new elements. But this is pretty much what List<t> does, so if you need to add elements to array often at runtime I would recommend you to use List<t> which also has a method called ToArray which return current state of List<t> as regular array.
hth
|
|
|
|
|
you can use arraylist for this purpose
|
|
|
|
|
Nouman Bhatti wrote: you can use arraylist for this purpose
No one uses the ArrayList anymore. The generic types in C# 2.0 have rendered it obsolete.
I suggest you check out the Generic List<>[^] type instead.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
You can use generic List<string> class.
|
|
|
|
|
Good Morning all
i have recently moved from vb.net to C#, infact not moved but learning to use them both.i have been building N-Tier Applications with vb.net and there was a time when i have send a message from a BLL to the PL(Presentation Layer) in this case a Form, am building Windows Application. Now i have a BLL(Class) and i want to Display a messagebox, inn vb.net "Messagebox.Show" did not work, but instead i used "msgbox()" and it worked fine, now in C#, am looking for a Similar Function that will alow me to do that. I saw something like "mbox", but it seems it does do what i want.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
MessageBox.Show() works from a class too. Make sure you are using System.Windows.Forms namespace.
|
|
|
|
|
Thanks man its working
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
mbox is a code snippet. If you type in mbox and then press the tab (twice I think), it expands the text out into MessageBox.Show. Similarly, if you type prop and press the tab again, you get a property.
|
|
|
|
|
Hi,
Notepad is loaded and I want to send message "Hello Notepad".
kindly give me the solution / ready made samples about said.
Thank you in advance
(Riaz)
|
|
|
|
|
|
Hi i am developing an application in which i have required to get the print of panel control along with other control that are placed in panel control. I am able to take the print but there is a problem that i want that there should occur an Print Dialog befor printing but print Dialog does not occur so how can Print Dialog shows before printing...
CODE:
Global Declaration:
PrintDocument printDocument1 = new PrintDocument();<br />
System.Drawing.Bitmap memoryImage;
AT FORM LOAD
this.printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
PRINT DOCUMENT
void printDocument1_PrintPage(object sender, PrintPageEventArgs e)<br />
{<br />
try<br />
{<br />
e.Graphics.DrawImage(memoryImage, 0, 0);<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message,"Message",MessageBoxButtons.OK,MessageBoxIcon.Warning);<br />
}<br />
}
AT BUTTON CLICK TO TAKE PRINT
int count = Application.OpenForms.Count;<br />
for (int i = 0; i < count; i++)<br />
{<br />
memoryImage = new System.Drawing.Bitmap(panel1.Width, panel1.Height);<br />
panel1.DrawToBitmap(memoryImage, panel1.ClientRectangle); <br />
printDocument1.Print();<br />
printDocument1.Dispose();<br />
}
THIS CODE IS WORKING PROPERLY BUT IT DESNOT SHOW PRINT DIALOG BEFORE PRINTING SO PLEASE TELL ME HOW CAN I SHOW PRINT DIALOG BEFORE PRINTING AND ALLOW USER TO CHOOSE HOW MANY PRINT HE WANTS TO PRINT...
|
|
|
|
|
I am using an Image Control that i found here:
http://www.codeproject.com/KB/vb/PanZoomExample.aspx
It is really good and very useful. I am building a map based system and need to retrieve the mouse coordinates on the map. The 'onclick', 'onmousedown','onemouseup' etc events are not working on this 'imagecontrol'. It doesnt trigger when i click anywhere on the map except for the border near the scrollbar. I tried with the normal picturebox control and it worked perfectly. But I obviously need to use this control because of the great features.
What should I do? why doesnt the event trigger on the image. I tried what someone (splater) had suggested on the messageboard of that page but to be honest i couldnt exactly understand what he meant........ mebbe coz im using VC# and some stuff might be diff from VB. I didnt understand what the drawingboard etc was.....I even tried getting the email id of the creator of that control but wasnt able to find it anywhere.
his is what i have been doing....... but it seems the events themselves are not firing..... nd i have no clue why
//imagecontrol name: img_Map
//clickPos is a global variable
<br />
private void img_Map_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
clickPos.X = e.X;<br />
clickPos.Y = e.Y;<br />
MessageBox.Show("Down");
}<br />
<br />
private void img_Map_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
MessageBox.Show("Up1");
if ((e.X == clickPos.X) && (e.Y == clickPos.Y))<br />
{<br />
MessageBox.Show("Up2");<br />
}<br />
}
I am doing this as the control also has panning feature when we click the mouse and move it. So i want it to give the coordinates only when the mousedown and mouseup occur at the same position (else it is panning).
But BOTH these events do not fire when i click on the image in the control. but it does work when i click on the border near the scrollbars.
I might be asking for a little too much, but if anyone could download that control and check it out, it would really be a huge favor.
http://www.codeproject.com/KB/vb/PanZoomExample.aspx
I am pretty much a newbie to C# and hence REALLY need HELP! Thanks to all those helping in advance.
|
|
|
|
|
123shailesh wrote: I am pretty much a newbie to C#
Which makes it ridiculous for you to be building a 'map based system' in C#. Someone is paying you to learn C# on the job ?
I answered this yesterday, but it looks like you're trying to take my advice ( well, it was the advice of someone who used the control before ). Assuming what they said had worked for them, I have to assume you're not hooking the events up ( in VB, they can be hooked up inline, in C# you need to do it in the designer, or in the constructor or load event ), or you're hooking them up to the wrong thing.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
How to create ascii fonts(.ttf) in windows.Thank You.
|
|
|
|
|
|
Hi there,
I'm looking for some advise for a generic data fetch pattern for IDataReader I'm working on, as follow:
using(GenericDataReader reader = new GenericDataReader(cm.ExecuteReader()))
{
while (reader.Read())
{
orders.Add(reader.Get<Order>());
}
}
public class GenericDataReader : IDataReader
{
public T Get<T>(string name)
{
int i = _dataReader.GetOrdinal(name);
if (_dataReader.IsDBNull(i))
return default(T);
else
return (T)_dataReader.GetValue(i);
}
public T Get<T>() where T : ILoadable, new()
{
T entity = new T();
entity.Load(this, false);
return entity;
}
}
public interface ILoadable
{
void Load(GenericDataReader reader, bool deep);
}
class Order : ILoadable
{
int id;
Customer customer;
DateTime orderDate;
DateTime requiredDate;
DateTime? shippedDate;
List<OrderDetail> orderDetails;
public Order(){ }
public Order(GenericDataReader reader)
{
Load(reader, true);
}
#region ILoadable Members
public void Load(GenericDataReader reader, bool deep)
{
id = reader.Get<int>("OrderID");
customer = reader.Get<Customer>();
orderDate = reader.Get<DateTime>("OrderDate");
requiredDate = reader.Get<DateTime>("OrderRequiredDate");
shippedDate = reader.Get<DateTime?>("OrderShippedDate");
if (deep && reader.NextResult())
{
orderDetails = new List<OrderDetail>();
while (reader.Read())
{
orderDetails.Add(reader.Get<OrderDetail>());
}
}
}
#endregion
}
What do you think? Are there any major drawback with this model I'm missing? Are there any more clever way to do that?
I really appreciate your time reading this. As long we come to a conclusion I'll write an article for CP with that we learned about it.
TIA,
Rubens
EDIT: Added formatting
modified on Thursday, March 20, 2008 6:44 AM
|
|
|
|
|
Hi,
can you please edit your post and place code in <pre> and <code> like this?:
<pre><code>your code</code></pre>
that would really help me to at least read your code. Thank you.
|
|
|
|
|
Sorry Michal, here you go.
ty
|
|
|
|