|
Guffa wrote: Standard question #2
What is standard question #1? and do you have a whole list of these standard questions?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Colin Angus Mackay wrote: What is standard question #1? and do you have a whole list of these standard questions?
Actually I do:
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
Standard question #3:
What does your code look like?
Standard question #4:
No, "nothing" never happens. Exactly what is happening?
Standard question #5:
No, that is not the code you are using. It can't produce that result. What does the code you are using look like?
---
b { font-weight: normal; }
|
|
|
|
|
Thanks
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Why don't you give us a hint first ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Just debug and find out where the error is occuring
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
My company is currently creating a prototype GUI in C# which accesses data in our old codebase (C++) through COM. We have things working pretty well, but have stumbled upon a very strange error, which I was curious if anyone else had run into as well.
After loading our C++ application through COM, I have some xslt files I'd like to transform. I can create XmlDocuments, XmlTextWriters, etc. all perfectly fine, but when I try to use the XslCompiledTransform.Load() function, the compiler just quits. There are no debug message of any sort, and I can't step into the method to see what it is trying to do. I've trying using every possible type of input parameter for the Load() method (string path, XmlDocument, etc.) and none of them seem to make a difference.
I know that something strange must be happening after we load our objects through COM, because if I create the XsltCompiledTransform class and load xslt files before the objects are loaded through COM, things work just fine. I've searched the web, and could not find this issue anywhere else. Any advice on this matter would be appreciated, and if more explaination is needed please let me know (I typed this up really quick, just heading out of work for the day). Thanks in advance.
|
|
|
|
|
HI.
I'm creating a dinamic image that types something with a spetial font. Of course, I have the font not installed on the server fonts dir, so I have to use it with a PrivateFontCollection.
My problem is that the code works in my local server (where I also don't have the font installed on my fonts dir), but when I uplad it to my host, it renders the text in arial, not on my font.
any ideas?
here's the code:
<br />
Bitmap oImage = new Bitmap(400,50,PixelFormat.Format32bppArgb);<br />
Graphics oGraphics = Graphics.FromImage(oImage);<br />
<br />
MemoryStream streamMemory = new MemoryStream();<br />
<br />
oGraphics.Clear(Color.Transparent);<br />
<br />
Color cInk = Color.FromArgb (127,0,0,0);<br />
<br />
Brush oBrush = new SolidBrush(cInk);<br />
<br />
PrivateFontCollection pfc = new PrivateFontCollection();<br />
pfc.AddFontFile(Server.MapPath("Mael____.ttf"));<br />
FontFamily family = pfc.Families[0];<br />
Font oFont = new Font(family, 28);<br />
<br />
<br />
oGraphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;<br />
<br />
string sText = "";<br />
try {<br />
sText = (Request.Params["Text"]);<br />
}<br />
catch{}<br />
<br />
oGraphics.DrawString(sText, oFont, oBrush, 1, 1);<br />
<br />
Response.ContentType = "image/png";<br />
<br />
oImage.Save(streamMemory, ImageFormat.Png);<br />
<br />
Byte[] buffer = streamMemory.ToArray();<br />
Response.Clear();<br />
Response.OutputStream.Write(buffer, 0, buffer.Length);<br />
<br />
Response.End();<br />
streamMemory.Close();<br />
oGraphics.Dispose();<br />
oImage.Dispose();<br />
|
|
|
|
|
Hi. Iam developing some app and for security reasons I want to disable running that app on certain computers.
I can do that by checking the hdd id. Is there any better way, because hdd is much more replaceable than CPU?
Sample:
Some user logs first time on to that app over the net. Program saves the hdd id into the database.
Next time user logs, app checks hdd id previously saved in database and if it's equal, then the user can be logged.
|
|
|
|
|
|
Hello kasic,
I think this[^] may usefull to you.
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Thank you very much, both of you.
This links you provide will help.
Thanks again.
|
|
|
|
|
Hey guys, whats up ?
I'm working on a repor in my C# form, I'm wondering if it's possible to send the result of my report to an exel file or microsoft word file ?
Thanks
Mr.K
|
|
|
|
|
In short yes!
Ed
|
|
|
|
|
Thanx for letting me know but can you please tell me how ?!
or if you have some sample codes that could help me out.
thanx
Mr.K
|
|
|
|
|
If you want to output to excel then the easiest will be in the CSV format (this will not apply any formatting). And RTF for Word likewise.
If you do want the special features of Excel and Word then Aspose have some components for creating and opening Word and Excel files.
Alternatively if you want a freebie then I'm sure (I seem to remember coming across them) there are articles on CP about how to do this.
Another alternative is to look into the Word and Excel XML formats (Office XP onwards), this may be the simplest option unless you can find an article on how to do it another way on CP.
Ed
|
|
|
|
|
Thanx that was helpful
Mr.K
|
|
|
|
|
Hi,
We are creating a C# Windows application using VS 2005.
It reads in an xml file and creates tab pages that each
have a datagrid that holds the specific information
for that tab's node.
We have been able to programmatically give the tab.text
(the label on the tabs), but when we try to add the
specific data for each tab into a datagrid on the
tab's page, all of the data gets added instead of the
data for just that node.
Perhaps we need to clear the grid first???
Any help would be appreciated.
Thank you in advance,
Anne
Here is a portion of the xml file we are using.
<?xml version="1.0" encoding="utf-8"?>
<inspection>
<inspforms>
<inspform>
<name>general</name>
<sections>
<section>
<tab>Heading</tab>
<label>
<name>id</name>
<type>text</type>
<value>
<single>200621</single>
</value>
</label>
<label>
<name>request
</name>
<type>text
</type>
<value>
<single>30
</single>
<choices>
<choice>
</choice>
</choices>
</value>
</label>
</section>
</sections>
</inspform>
<inspform>
<name>Risk</name>
<sections>
<section>
<tab>Operations</tab>
<label>
<name>Business Type</name>
<type>radio</type>
<value>
<choices>
<choice>
<choicename>Corporation</choicename>
<choicevalue>
</choicevalue>
</choice>
<choice>
<choicename>LLC</choicename>
<choicevalue>
</choicevalue>
</choice>
<choice>
<choicename> Partnership</choicename>
<choicevalue>
</choicevalue>
</choice>
<choice>
<choicename>Sole Proprietor</choicename>
<choicevalue>
</choicevalue>
</choice>
</choices>
</value>
</label>
<label>
<name>Years in Business</name>
<type>text</type>
<value>
<single>
</single>
</value>
</label>
</section>
</sections>
</inspform>
</inspforms>
</inspection>
Here is the pertinent code:
//frmMain.cs
<br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
<br />
using ABC.Components;<br />
using ABC.Globals;<br />
<br />
namespace ABC.Forms<br />
{<br />
public class frmMain : System.Windows.Forms.Form<br />
{<br />
public const string Path = @"C:\ABCXmls\abcBase.xml";<br />
public ArrayList ArrayListTabs;<br />
<br />
private ABC.Components.abcTabArea abcTabArea1;<br />
<br />
private System.ComponentModel.Container components = null;<br />
<br />
public frmMain()<br />
{<br />
<br />
XmlHelper.OpenFile(Path);<br />
ArrayListTabs = new ArrayList();<br />
ArrayListTabs = XmlHelper.GetArrayList("tab");<br />
InitializeComponent();<br />
}<br />
#region InitializeComponent()<br />
<br />
private void InitializeComponent()<br />
{<br />
...<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new frmMain());<br />
}<br />
<br />
private void frmMain_Load(object sender, EventArgs e)<br />
{<br />
this.abcTabArea1.CreateTabs(this.ArrayListTabs, Path);<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
...<br />
}<br />
<br />
<br />
}<br />
}<br />
}<br />
//xmlHelper.cs
<br />
using System;<br />
using System.Collections;<br />
using System.Data;<br />
using System.IO;<br />
using System.Xml;<br />
<br />
<br />
namespace ABC.Globals<br />
{<br />
public class XmlHelper<br />
{<br />
private static XmlDocument XmlDocument1;<br />
<br />
public static void OpenFile(string path)<br />
{<br />
XmlDocument1 = new XmlDocument();<br />
XmlDocument1.PreserveWhitespace = false;<br />
XmlDocument1.Load(path);<br />
}<br />
public static ArrayList GetArrayList(string elementName)<br />
{<br />
ArrayList arrayList1 = new ArrayList();<br />
<br />
XmlNodeList xmlNodeList1 = XmlDocument1.GetElementsByTagName(elementName);<br />
<br />
for (int idx = 0; idx < xmlNodeList1.Count; idx++) <br />
{<br />
XmlElement xmlElement1 = (XmlElement) xmlNodeList1[idx];<br />
arrayList1.Add(xmlElement1.InnerText);<br />
}<br />
<br />
return arrayList1;<br />
}<br />
}<br />
}<br />
//abcTabArea.cs
<br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
<br />
namespace ABC.Components<br />
{<br />
public class abcTabArea : System.Windows.Forms.UserControl<br />
{<br />
internal TabControl TabControl1;<br />
internal string Path = "";<br />
<br />
<br />
private System.ComponentModel.Container components = null;<br />
<br />
public jmpBottom()<br />
{<br />
abcTabArea();<br />
}<br />
<br />
#region InitializeComponent()<br />
private void InitializeComponent()<br />
{<br />
...<br />
}<br />
#endregion<br />
<br />
public void CreateTabs(ArrayList arrayListTabNames1, string path)<br />
{<br />
this.Path = path;<br />
for (int idx = 0; idx < arrayListTabNames1.Count; idx++)<br />
{<br />
string tab = "";<br />
tab = arrayListTabNames1[idx].ToString();<br />
<br />
System.Windows.Forms.TabPage abcTabPage = new TabPage(tab);<br />
<br />
abcPage abcPage = new abcPage(tab,this.Path,idx);<br />
<br />
this.abcTabControl1.Controls.Add(abcTabPage);<br />
abcTabPage.Controls.Add(abcPage);<br />
<br />
}<br />
}<br />
<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
...<br />
}<br />
<br />
}<br />
}<br />
\\abcPage.cs
<br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
using System.Xml;<br />
<br />
<br />
namespace ABC.Components<br />
{<br />
<br />
public class abcPage : System.Windows.Forms.UserControl<br />
{<br />
internal string NodeName = "";<br />
internal string Path = "";<br />
internal int indexNum = 0;<br />
private System.Windows.Forms.Panel panel1;<br />
private System.Windows.Forms.DataGrid dataGrid1;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public jmpPage(string nodeName, string path, int indexNum)<br />
{<br />
this.NodeName = nodeName;<br />
this.Path = path;<br />
this.indexNum = indexNum;<br />
InitializeComponent();<br />
Populate();<br />
}<br />
<br />
#region InitializeComponent()<br />
<br />
private void InitializeComponent()<br />
{<br />
this.panel1 = new System.Windows.Forms.Panel();<br />
this.dataGrid1 = new System.Windows.Forms.DataGrid();<br />
this.panel1.SuspendLayout();<br />
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();<br />
this.SuspendLayout();<br />
this.panel1.Controls.Add(this.dataGrid1);<br />
this.panel1.Location = new System.Drawing.Point(0, 0);<br />
this.panel1.Name = "panel1";<br />
this.panel1.Size = new System.Drawing.Size(800, 528);<br />
this.panel1.TabIndex = 0;<br />
this.dataGrid1.DataMember = "";<br />
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;<br />
this.dataGrid1.Location = new System.Drawing.Point(0, 0);<br />
this.dataGrid1.Name = "dataGrid1";<br />
this.dataGrid1.Size = new System.Drawing.Size(800, 528);<br />
this.dataGrid1.TabIndex = 0;<br />
this.Controls.Add(this.panel1);<br />
this.Size = new System.Drawing.Size(800, 528);<br />
this.panel1.ResumeLayout(false);<br />
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
internal void Populate()<br />
{<br />
DataSet dataSet1 = new DataSet();<br />
XmlDocument XmlDocument1;<br />
XmlDocument1 = new XmlDocument();<br />
XmlDocument1.PreserveWhitespace = false;<br />
XmlDocument1.Load(this.Path);<br />
<br />
XmlNodeList xmlNodeList = XmlDocument1.GetElementsByTagName("section");<br />
<br />
XmlElement xmlElement1 = (XmlElement) xmlNodeList[this.indexNum];<br />
dataSet1.ReadXml(this.Path);<br />
dataGrid1.DataSource = dataSet1;<br />
dataGrid1.DataMember = "section";<br />
dataGrid1.CaptionText = dataGrid1.DataMember;<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
...<br />
}<br />
}<br />
}<br />
|
|
|
|
|
I have several labels stored in an array of label controls (Label[] drgLabel). The labels are placed in a panel control. I want to be able to move the labels around the panel using drag and drop technics. I do not know how to get the mouse_over event associated with the label because the labels do not have specific names. Do I have to write the mouse_over event for the array of labels (drgLabel)? Any suggestions will be greatly appreciated.
cbeasle1
|
|
|
|
|
You can bind the events in a loop:
foreach (Label label in drgLabel) {
label.MouseOver += new MouseEventHandler(drgLabel_MouseOver);
}
Which Label actually received the vent can be obtained from the sender. You surely have to cast this one:
private void drgLabel_MouseOver(object sender, MouseEventArgs mea) {
Label label = (Label)sender;
}
All events needed for drag and drop can be bound this way.
|
|
|
|
|
I have a program that was running really well on my computer. For sometime now, it has been running really slow and I find it hard to understand. I have scanned for viruses and spyware but couldn't find any and no possible reasons as the why the program is running that slow. Any suggestions? My computer specification is : pentium4, 3.40GH, 512MB
Nana
|
|
|
|
|
1) Is this the correct forum, is it a C# program?
2) Has your disk been defragged recently?
3) Do you have lots of services / background apps running?
Ed
|
|
|
|
|
It is a C# project i am working. I do not have lots of back apps running. This is because I am running below the physical memory. Yes it has been fragmented . Thank you.
Nana
|
|
|
|
|
Well, there could be thousands of reasons...
What kind of program is it? What does it do? Who made it? How slow is "really slow" really?
---
b { font-weight: normal; }
|
|
|
|
|
I am new to C#, and I have compiled a simple exe (a WindowsFormsApp, not a console app) to perform an operation, and want to notify the calling application when it has completed and return a status code.
ApplicationExit();
Just seems to exit, and even if I try to set a return code with:
System.Environment.ExitCode = #;
I don't seem to get anything either.
Can anyone help??
Thanks,
Mark
|
|
|
|
|
Hello,
Try the following
[STAThread]
static void Main()
{
Application.Run(new Login());
return 999;
}
In the retun, you get the exit code
/// -----------------------
Braulio Díez
http://www.bdiez.com
/// -----------------------
|
|
|
|