|
MarkBrock wrote: But when I try it on commercial assemblies (such as ITunes or something similar) I get an error saying that it could not find a command line interface.
I suspect ITunes is not a .NET application.
MarkBrock wrote: Could anyone explain why this is so? Is it do with the language it was written in?
It is to do with what it is compiled to rather than what it is written in. If it is compiled to CIL (sometimes known as MSIL) Reflector will work - because that's what it is reflecting on. If it is a native DLL then it won't.
|
|
|
|
|
Thanks Colin .
Mark.
|
|
|
|
|
Hi,
I am getting to where I need to be, but slow going, and thanks for all of the previous help.
What I have so far...
Form loads and checks to see if xml file exists, if it does, it loads into runtime dataset and binds to datagrid:
CODE
private void Form1_Load(object sender, EventArgs e)
{
try
{
//File.OpenRead("C:\\DriveData.xml");
DataSet ds1 = new DataSet();
ds1.ReadXml("C:\\DriveData.xml");
dataGridView1.DataSource = ds1;
dataGridView1.DataMember = "DriveInfo";
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
Console.WriteLine("Use the Open File button.");
}
}
On the form, if the datagrid is not populated, the user can load an excel file:
CODE
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "Excel (*.xls)|*.xls";
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
using (System.Data.OleDb.OleDbConnection objCon = new System.Data.OleDb.OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";",
openFileDialog1.FileName)))
using (System.Data.OleDb.OleDbCommand cm = new System.Data.OleDb.OleDbCommand("Select * From [sheet1$]", objCon))
using (System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(cm))
{
DataSet ds1 = new DataSet();
objCon.Open();
da.Fill(ds1,"DriveInfo");
objCon.Close();
ds1.WriteXml("C:\\DriveData.xml",XmlWriteMode.WriteSchema);
ds1.ReadXml("C:\\DriveData.xml");
dataGridView1.DataSource = ds1;
dataGridView1.DataMember = "DriveInfo";
}
}
}
This works great, but the part that I thought would be easier is harder for me at least.
I have a strong typed dataset created in my vs project with one datatable.
This dataset is part of the same initial form that loads and is binded to textbox, and other type controls.
I also have the binding source and binding navigator components at the bottom of the design screen for this dataset.
Here is what I want to do...
I want to write the strong typed dataset to an xml file, just like the weak typed one before, and then reload the xml file back to the dataset, maybe this step is not neccessary until I have changed data.
Anyway, I want this dataset editable/updated as if it were connecected to a dataadapter that was connected to a database.
My Save Button is greyed out on the binding navigator.
When I save changes, I want to have them save to the xml file, so that even if the application closes, the changes will be there.
Thanks, sorry for long winded.
|
|
|
|
|
pingboy wrote: I want to write the strong typed dataset to an xml file, just like the weak typed one before, and then reload the xml file back to the dataset,
DataSet.WriteXml("MyFile.xml");
DataSet.ReadXml("MyFile.xml");
only two letters away from being an asset
|
|
|
|
|
Hi all,
I have a Share Point server when i installed a windows service that use "remoting" technology - using IpcChannel. From the local machine everything work fine: i opened a website from the ie browser and when the SharePoint's server executed the code from OnInit method everything works fine (SharePoint server gets the proxy from Windows Service and wrote some results in a text file). The problem appears when i tried to access a website from another machine (other than the machine where i installed the windows service): so in OnInit method i initialized the remoting (create the IpcChannel, register the channel and i got the proxy object but when i tried to call a method from proxy object i received the following error message: Failed to create an IPC Port: Access is denied. I think that the problem is about the user security but i can't find the problem
Thanks a lot
Regards
Mitrea Bogdan
|
|
|
|
|
I am really turning nuts!
I have the following problem: I have a library that is MTA by design - and I cannot modify it, I have only the assambly. So far so good, but my application is a WPF application. And that in turn is STA by design.
So my simple question: How can both talk to each other? More precisely, there are no problems unless callbacks from the MTA-library are executed. I would like to give some feedback through the GUI, but nothing happens (ok, at least there is a caught exception that the GUI an only be modified from a STA thread... fine, so my delegate is still executed out of some library's thread)
The simple delegate does not work, implementing a wrapper with some event does not either. Posting a "real" Windows Message and grabbing data out of the wrapper would work, but that cannot be the best answer for my problem... can it??
Any help appreciated to make my code some kind of more professional.
Don Rolando
|
|
|
|
|
When you get a callback from the MTA library, just post to the Dispatcher of your WPF app to do the UI-related work. See MSDN's WPF Threading Model[^] for more info.
|
|
|
|
|
You are my man! Thanks a lot, that was it! The Dispatcher... argh, of course.
|
|
|
|
|
|
Thank a lot, but Judah's post gave me already the answer I searched for. (And it was about the same as the German page was about)
|
|
|
|
|
I am wondering is there a way not to repaint/redrawn an item while scrolling up and down in listbox. I want to eliminate heavy repaint. I couldn't find any resource that to cache these items.
Thanks
|
|
|
|
|
owner draw them and just sometimes do nothing when the event is called
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 )
|
|
|
|
|
Can you explain me a bit more i am painting in my own paint method but there is n't any event for scollingdown i can catch. Thanks for answering
|
|
|
|
|
hey can anyone can please help im new to c#, im trying to add a button to my program that will make a copy/backup of a file, the location of the orignal file is static so no need for dir listboxes. the problem i have is when it come to creating the copy.
private void button1_Click(object sender, EventArgs e)<br />
{<br />
folderBrowserDialog1.Description = "Select a Directory to Back up the Database";<br />
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)<br />
{<br />
System.IO.File.Copy("c:/test.txt", folderBrowserDialog1.SelectedPath + "UNKNOWN.txt", true);<br />
MessageBox.Show("File saved to " + folderBrowserDialog1.SelectedPath, "Backup Made", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
}
any help would be great
|
|
|
|
|
I'm not getting any syntax error, however the file isn't copying if SelectedPath doesn't have a slash at the end.
+ "/UNKNOWN.txt" is a quick fix but you'll be better off testing the last character of the SelectedPath and appending the slash so you don't end up with two slashes if a root folder is selected.
Dave
|
|
|
|
|
just seen that i missed the "/", what an idiot... cheers!
|
|
|
|
|
Hi,
I'm coding a Windows Service (using the Service Project in VS 2005) and in some occasions I would need to terminate in a clean way the service from inside of the code. In OnStart I create a worker thread, and I need this thread to, somehow, terminate the service. What is the best way to do it?
Thanks,
Federico
|
|
|
|
|
The following code is used to upload the wave(vox) file(without asp.net control) using c# .
Its IVR project.
Front end :voicexml
Back end :c# aspx
RecordAudio.cs
***************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Web;
using System.IO;
namespace DMVEmergencyMessagesUtil
{
public class RecordAudio
{
UploadedFile upFile = new UploadedFile();
Stream s = null;
Stream sGetFileName = null;
Byte[] streamArray = null;
public void EquivalentConversion(string strFilePath, string strFileName, string strFileType, Stream s1)
{
s = s1; //HttpContext.Current.Request.InputStream;
string biData, sInputName, vDataBounds;
int nPosBegin, nPosEnd, nPos, nDataBoundPos, nPosFile, nPosBound;
char c = (char)13; //return key
byte[] bytArr = new byte[HttpContext.Current.Request.TotalBytes];
string strCheck = bytArr.GetValue(5).ToString();
biData = RequestInputStreamToString();
nPosBegin = 1;
nPosEnd = biData.IndexOf(c);
if (nPosEnd > 0)
{
}
if ((nPosEnd - nPosBegin) <= 0)
{
return;
}
vDataBounds = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
nDataBoundPos = biData.IndexOf(vDataBounds, 1);
string sFileName = string.Empty;
string sFileNamePath = string.Empty;
string ContentType = string.Empty;
string tempdata = string.Empty;
do
{
nPos = biData.IndexOf("Content-Disposition", nDataBoundPos);
nPos = biData.IndexOf("name=", nPos);
nPosBegin = nPos + 6;
nPosEnd = biData.IndexOf((char)34, nPosBegin);
sInputName = biData.Substring(nPosBegin, nPosEnd - nPosBegin + 1);
nPosFile = biData.IndexOf("filename=", nDataBoundPos);
nPosBound = biData.IndexOf(vDataBounds, nPosEnd);
if (nPosFile != 0)//&& nPosFile < nPosBound)
{
nPosBegin = nPosFile + 10;
nPosEnd = biData.IndexOf((char)34, nPosBegin);
sFileName = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
sFileNamePath = sFileName;
nPos = biData.IndexOf("Content-Type:", nPosEnd);
nPosBegin = nPos + 14;
nPosEnd = biData.IndexOf((char)13, nPosBegin);
upFile.ContentType = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
ContentType = upFile.ContentType;
nPosBegin = nPosEnd + 4;
nPosEnd = biData.IndexOf(vDataBounds, nPosBegin) - 2;
upFile.setArrSize = nPosEnd - nPosBegin;
Array.Copy(streamArray, nPosBegin, upFile.m_fileDataNew, 0, nPosEnd - nPosBegin);
upFile.FileData = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
upFile.FileName = strFileName;
upFile.FileType = strFileType;
string strPath = HttpContext.Current.Server.MapPath(strFilePath);
strPath = strPath + strFileName + strFileType;
upFile.SaveToDisk(strPath);
}
} while (nDataBoundPos == biData.IndexOf(vDataBounds + "--"));
}
public string RequestInputStreamToString()
{
StringBuilder sb = new StringBuilder();
int streamLength; int streamRead;
streamLength = Convert.ToInt32(s.Length); streamArray = new Byte[streamLength];
streamArray.ToString();
streamRead = s.Read(streamArray, 0, streamLength);
string test = System.Text.Encoding.Default.GetString(streamArray); for (int i = 0; i < streamLength; i++)
{
sb.Append(Convert.ToChar(streamArray[i]));
if (i == 150)
{
sb.ToString();
}
}
return sb.ToString();
}
}
}
UploadedFile.cs
***************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.IO;
namespace DMVEmergencyMessagesUtil
{
public class UploadedFile
{
public UploadedFile()
{
//m_fileDataNew = new byte[arrLen];
}
public byte[] m_fileDataNew;
private string m_contentType, m_fileName, m_fileData,m_fileType;
public string ContentType
{
set
{
m_contentType = value;
}
get
{
return m_contentType;
}
}
public string FileType
{
set
{
m_fileType = value;
}
get
{
return m_fileType;
}
}
public Int32 setArrSize
{
set
{
m_fileDataNew = new byte[value];
}
}
public string FileName
{
set
{
m_fileName = value;
}
get
{
return m_fileName;
}
}
public string FileData
{
set
{
m_fileData = value;
}
get
{
return m_fileData;
}
}
public int getfileSize()
{
return FileData.Length;
}
public void SaveToDisk(string sPath)
{
if (sPath == string.Empty) return;
string MyString = FileData;
byte[] data = Encoding.Default.GetBytes(MyString);
FileStream fs = File.Create(sPath);
fs.Write(m_fileDataNew, 0, m_fileDataNew.Length);
fs.Close();
}
}
}
RecordMessage.aspx
*******************
]]>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
]]>
]]>
]]>
]]>
]]>
]]>
]]>
]]>
]]>
<block>
<return>
|
|
|
|
|
Great, and...?
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Great. Write an article. The forums are for asking questions, not for sharing your code.
only two letters away from being an asset
|
|
|
|
|
hello,
can someone know how to create a c# application based on a specific software architecture or diagrams.
for example if the developper try to create a class not included in the architecture diagram so he cannot.
tanks
dghdfghdfghdfghdgh
|
|
|
|
|
What is it you are trying to do? I can't really understand your English...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hey if the architecture contain 2 classes so the developper cannot create in his project more than these 2 classes
dghdfghdfghdfghdgh
|
|
|
|
|
What are you talking about, how does creating class depends on architecture?!#@$? i dont understand!! did you mean class digram?
|
|
|
|
|
Oh I get what he's saying now. The answer to his question is 4.
Mark.
|
|
|
|
|