|
If I just use SQL Server on client's machine, they're the one who will set up username & password. I would like everything to be automated (1 installer if possible) which has its own database
|
|
|
|
|
hi all,
I am always get the error below:
An unhandled exception of type 'System.StackOverflowException' occurred in TimewayGeneratorRev2.exe
This occur when i declare a form,like below:
namespace TimewayGeneratorRev2
{
public partial class FrmProSetting : Form
{
FrmMain fMain = new FrmMain(); <---------an exception above high light here
public FrmProSetting()
{
InitializeComponent();
}
}
}
Can someone help me on this
Note: In my application, i have few forms.
regards
cocoon
modified on Thursday, April 17, 2008 4:58 AM
|
|
|
|
|
StackOverflowException occurs when you call methods too deeply, and the stack of method calls gets too big to hold in the memory reserved for the stack. StackOverflows often occur when you get stuck in a recursive loop. When it occurs, look at the callstack (Debug->Windows->Callstack) and look back along it. You'll probably find it's going round and round in a circle calling the same methods over and over again. You need to break this loop. Remove one of the calls so the loop doesn't occur.
Look in the FrmMain constructor, are you creating a FrmProSetting form from there?
Simon
|
|
|
|
|
hi Simon,
Thanks for your fast reply. Yes, i have create a FrmProSetting form in frmMain.
|
|
|
|
|
|
hi
how Can i invoke visual studio built-in Query Builder
at runtime ?
|
|
|
|
|
|
can i call the query builder ( that is available at design time ) at run time
|
|
|
|
|
Muneer Safi wrote: can i call the query builder ( that is available at design time ) at run time
Outside of Visual Studio - no. It's a part of Visual Studio - it's not a part of the .NET runtime (unlike the Windows Forms designer). There are licensing implications, so the answer is no.
|
|
|
|
|
dear all,
i'm a newbie in .net
i want to ask, how to make multiple datakeys in datagridview or gridview and how to retrieve them
thx
|
|
|
|
|
if ((age.LiteracyLevel(user.questionAsker()) <= 6 ) || (question.containsCapitals() == false))<br />
{<br />
}<br />
<br />
<br />
else if (age.LiteracyLevel > 6)<br />
{<br />
Console.WriteLine("Grammer improvement successfuly.");<br />
Console.WriteLine("Welcome to the English Language.");<br />
Console.WriteLine("Helping...");<br />
helpUser(user.questionAsker());<br />
}
-_-
|
|
|
|
|
Hi,
I created an application which will zip .txt files into .zip
For each textfile I selected in my listbox it creates one zip file.
But I want to modify it now so all files I select would come in one zip file.
This is a part of my form.cs file:
public Form1()
{
InitializeComponent();
listBox1.SelectionMode = SelectionMode.MultiExtended;
listBox1.DataSource = ClassFile.GetFiles(@"C:\");
}
private void button1_Click(object sender, EventArgs e)
{
ArrayList bestanden;
string StoragePath;
string OldFile;
string NewFile;
string[] split;
int i;
bestanden = new ArrayList();
StoragePath = @"C:\";
for (i = 0; i < listBox1.SelectedItems.Count; i++)
{
split = listBox1.SelectedItems[i].ToString().Split('.');
bestanden.Add(split[0]);
}
listBox2.Items.Clear();
foreach (string bestand in bestanden)
{
OldFile = StoragePath + bestand + ".txt";
NewFile = StoragePath + bestand + ".zip";
listBox2.Items.Add("Tekst bestand: " + OldFile);
ClassFile.FileToZip(StoragePath, OldFile, NewFile);
if (ClassFile.Overschijven == true)
{
listBox2.Items.Add("ZIP conversie succesvol: " + NewFile);
}
else
{
listBox2.Items.Add("ZIP conversie mislukt: " + OldFile);
}
}
}
This is my class file:
public ArrayList GetFiles(string dir)
{
ArrayList list;
DirectoryInfo di;
FileInfo[] rgFiles;
list = new ArrayList();
di = new DirectoryInfo(dir);
rgFiles = di.GetFiles("*.txt");
foreach(FileInfo fi in rgFiles)
{
list.Add(fi.Name);
}
return list;
}
public void FileToZip(string zipFileStoragePath, string fileToCompress, string zipFileName)
{
if (File.Exists(fileToCompress) == false)
{
MessageBox.Show("Bestand niet gevonden.", "Fout", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (File.Exists(zipFileName))
{
YesOrNo = (int)MessageBox.Show("Dit bestand bestaat al. Wilt u het overschrijven?", "Bestand bestaat al", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
}
if (YesOrNo == (int)DialogResult.No)
{
Overschijven = false;
}
else
{
try
{
Overschijven = true;
Crc32 crc = new Crc32();
ZipOutputStream zip = new ZipOutputStream(File.Create(zipFileName));
zip.SetLevel(9);
FileStream fs = File.OpenRead(fileToCompress);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
ZipEntry entry = new ZipEntry(ZipEntry.CleanName(fileToCompress));
entry.DateTime = DateTime.Now;
entry.ZipFileIndex = 1;
entry.Size = fs.Length;
fs.Close();
crc.Reset();
crc.Update(buffer);
entry.Crc = crc.Value;
zip.PutNextEntry(entry);
zip.Write(buffer, 0, buffer.Length);
zip.Finish();
zip.Close();
}
catch (Exception ex)
{
MessageBox.Show(("Error: " + ex.Message), "Error");
}
}
}
}
Can someone help me or say which part I need to change?
Any help would be greatly appriciated.
Regards,
Ronald
|
|
|
|
|
Hi all,
I have a panel with a couple of controls on it. I then loop through the controls on the panel:
...
foreach (Control stockAddControl in xPPanelAddStock.Controls)
{
...
But for some or other reason, it loops through the control collection backwards (starting at the last control first). Am I doing something wrong or what ??
Can anyone please assits me in this matter.
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: Am I doing something wrong
No. The ControlCollection class implements IList, which means it maintains the order of it's items based on the order they were added in to the collection. If you look in the forms InitializeComponent method, you will see the controls being added to the collection. This is the order they will be coming out in when you foreach over the collection. (Don't ask me how the designer decides on the order to put the controls in the collection because I don't know)
If this isn't the order you want them to come out in, you need to maintain your own collection of controls and sort them yourself.
You could have use a generic SortedList. and add all your controls to the sorted list.
SortedList<string, control=""> myListOfControls;
myListOfControls.Add(button1.Name, button1);
myListOfControls.Add(button2.Name, button2);
myListOfControls.Add(button3.Name, button3);
</string,>
This sorted list would now hold those button controls sorted into order by their names. When you foreached across myListOfControls, you'll get them out in order of name now.
Does that help?
Simon
|
|
|
|
|
Hi Simon,
Thanks for the reply and the help.
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
We are trying to fetch Author, Company Name and Creation Date of MS Office Files (.doc, .docx, .xls, .xlsx, .ppt, .pptx) using following code
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
string strFileName = string.Empty;<br />
strFileName = @"D:\My File.pptx";<br />
<br />
DSOFile.SummaryProperties DSOSummaryProperties;<br />
DSOFile.OleDocumentPropertiesClass OleFile;<br />
OleFile = new OleDocumentPropertiesClass();<br />
OleFile.Open(strFileName, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);<br />
DSOSummaryProperties = OleFile.SummaryProperties;<br />
<br />
Response.Write("Author : " + DSOSummaryProperties.Author);<br />
Response.Write(" Company : " + DSOSummaryProperties.Company);<br />
Response.Write(" Date Created : " + DSOSummaryProperties.DateCreated);<br />
OleFile.Close(false);<br />
<br />
}
This works well in many conditions except stated below
1. If we try to rename .docx as .doc or .xlsx as .xls or .pptx as .ppt
In this situation no data is fetched, but no error too
2. When file is created like,
Right Click in any drive -> New ->
New Microsoft Office Word Document.docx
or
New Microsoft Office Excel Worksheet.xlsx
or
New Microsoft Office PowerPoint Presentation.pptx
In this case while opening the file following error is generated
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Please guide, if any one knows the reason behind.
More over how to fetch meta data of .xps files?
modified on Thursday, April 17, 2008 4:06 AM
|
|
|
|
|
Same issue with my code!!
(Exception from HRESULT: 0x80004005 (E_FAIL))
Did you find any solution for this???
Please reply
|
|
|
|
|
Hi,
I need to open a well-formatted xml file (but not valid against DTD), i tried the following, sill reciving error:
// <!DOCTYPE article SYSTEM "xyz.dtd">
txtReader = new XmlTextReader(@"D:\abc.xml");
reader = new XmlValidatingReader(txtReader);
reader.ValidationType = ValidationType.None;
xDoc = new XmlDocument();
xDoc.Load(reader);
Regards,
Hariharan C.
|
|
|
|
|
If you don't want to validate the XML file against a DTD, why are you using the XmlValidatingReader at all? Just remove it.
BTW, unless you are still using .NET 1.x, the XmlValidatingReader[^] is now obsolete. You should use the validation options available on the XmlReader class instead.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi, I am new to C#. I tried with the following and succeeded,
txtReader = new XmlTextReader(@"abc.xml");
txtReader.XmlResolver = null;
xDoc = new XmlDocument();
xDoc.Load(txtReader)
Thanks,
Hariharan C.
|
|
|
|
|
|
using System.IO;<br />
<br />
StreamWriter sw = new StreamWriter(@"C:\filename.LOG");<br />
sw.WriteLine("Log Over Here!");<br />
sw.Flush();<br />
sw.Close();
Enjoy
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
class TextFile
{
public static void Main(string[] args)
{
string inFile;
string yazi;
Console.WriteLine("filename input");
Console.WriteLine("Sample: d:\\filename.LOG");
inFile = Convert.ToString(Console.ReadLine());
StreamReader dosyaOku = File.OpenText(inFile);
yazi = dosyaOku.ReadLine();
string onEk = " Frequencies -- ";
int i = 1;
string[] parcalar = null;
while (yazi != null)
{
if (yazi.StartsWith(onEk))
{
string gecici = yazi.Replace(onEk, "");
parcalar = gecici.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine(string.Format("{0}\n{1}\n{2}", parcalar[0], parcalar[1], parcalar[2]));
i++;
}
yazi = dosyaOku.ReadLine();
}
Console.ReadLine();
dosyaOku.Close();
StreamWriter sw = new StreamWriter(@"C:\filename.LOG");
sw.WriteLine(string.Format("{0}\n{1}\n{2}", parcalar[0], parcalar[1], parcalar[2]));
i++;
sw.Flush();
sw.Close();
}
firstly thanks for help you. now it is saving only one line to file:
1093.5623 1094.7121
called file contents:
Frequencies -- 1093.5623 1094.7121
Red. masses -- 6.4909 1.3756
Frc consts -- 4.5735 0.9713
Frequencies -- 0.0002 0.0400
Raman Activ -- 0.0000 0.0000
Depolar (P) -- 0.7162 0.6260
Frequencies -- 0.8346 0.7700
output data
1093.5623
1094.7121
0.0002
0.0400
0.8346
0.7700
I want to write to a file as a column "OUTPUT DATAS"
|
|
|
|
|
Hi,
You may try the following code snippet to write the output into a file (.txt)
BEGIN CODE
// create a writer and open the file
TextWriter tw = new StreamWriter("FilePath\FileName.txt");
// write a line of text to the file
tw.WriteLine(yourdata);
// close the stream
tw.Close();
END CODE
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
If you're going to accept user input as a given file path, check it exists before you start performing these operations. One of the first rules of such programs, treat the input as if it were entered by a bunch of 3 year olds mashing the keyboard with a spoon
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|