|
Would Mono's full static compilation be of any help?
edit: of course they could crack it all the same, but it would be harder Last modified: 7hrs 44mins after originally posted --
|
|
|
|
|
Stop trying, it's not worth it.
|
|
|
|
|
Hi every one,
Am unable to resolve this error:
Error: The assembly "D:\ActiveXProjects\csharpactivexglobe\csharpactivexglobe\bin\Debug\csharpactivexglobe.dll" could not be converted to a type library. Type library exporter encountered an error while processing'csharpactivexglobe.Globe.ActiveXObject, csharpactivexglobe'. Error: Element not found. csharpactivexglobe
I was trying to do regasm /codebase /tlb MyAssemblie.dll but unable to convert to a type library. Could you please give me any suggession to fix this error.
Thanking you all in advance,
Cheers & Regards,
Sharat.
sharat
|
|
|
|
|
First of all, C# cannot target building an ActiveX component. It can make something that looks and acts like one, but isn't a true ActiveX.
Which brings me to the question. Is this component attributed to be exposed to COM?
|
|
|
|
|
I have had the same problem sice yesterday, I was spending today to find out waht the problem is.
Beside some solutions I hvae found (duplicate guid for assembly and class) but did not work for me, I found the solution for me:
I am using a vb6 com-class library dll as a reference in my .NET project. I have changed that com class library dll by removing a function from one of the classes, because it is no more used/needed. After adding this function and recompiling the vb6 com library, registering again in .NET project, the problem was gone. It seams, that the type library exporter remebers some information somewhere, that even a clean did not swipe out. My be the old version of the type library was still hanging aaround somewhere in the registry.
Afterwards I again removed the unnecessary function from the dll, unregistered to old one registered the new one and, even then the problem was gone. So seams to be a windows registry mystery. I hope it helps some folks, so they do not search and loose hours and hours like i did.
Wolfiko
|
|
|
|
|
Wow Thanks... I will try this and see if it is my issue.
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Hi Everyone,
Can someone suggest /advise me that how can i print raw content of a page like electricity bill or any utility invoice which have same format. I have print a page which is already have all columns like last name, first name and Address column but content for every column will change based on user input.
Thanks in advance.
|
|
|
|
|
Here you go[^]
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Hi, I built a checkers game in C# in which players sitting next to each other can play. I am now trying to upgrade it, to become internet based. I want to generate a simple P2P connection. I wrote this code to see if a connection is established but for some reason it freezes when pressing the connection button. Please help me sort this out.
Or if you think this code is unsuitable, than please help me out with this..
here is the code
string clientOrServer;
Stream _stream;
string read;
Stream getTcpStream()
{
TcpClient client;
IPEndPoint meetingPoint = new IPEndPoint(IPAddress.Parse("79.178.57.135"), 8080);
if(clientOrServer.ToLower().StartsWith("c"))
{
client = new TcpClient();
client.Connect(meetingPoint);
}
else
{
TcpListener listener = new TcpListener(meetingPoint.Port);
listener.Start();
client=listener.AcceptTcpClient();
listener.Stop();
}
return client.GetStream();
}
void clientServerclick(System.Windows.Forms.PictureBox picturebox)
{
StreamWriter writer = new StreamWriter(_stream);
writer.AutoFlush = true;
if (picturebox == pictureBox89)
{
writer.WriteLine("{0}", pictureBox89);
}
if (picturebox == pictureBox51)
{
writer.WriteLine("{0}", pictureBox51);
}
}
void readclick()
{
StreamReader reader = new StreamReader(_stream);
string a = reader.ReadLine();
Console.WriteLine(a);
}
this is the code for client generating connection
clientOrServer = "c";
_stream = getTcpStream();
Console.WriteLine("Connected");
server
clientOrServer = "s";
_stream = getTcpStream();
Console.WriteLine("Connected");
this runs when a click on a soldier occurs
clientServerclick(pictureBox);
If this code is off, please guide me on how to accomplish this sort of thing.THANKS
|
|
|
|
|
try to create a worker Thread to call readclick()
Calin
|
|
|
|
|
do I need a reader thread too then?
|
|
|
|
|
or add the thread only for getTcpStream();
Calin
|
|
|
|
|
can u give the line for this please.. because when i try
Thread tcp = new Thread(new ThreadStart(getTcpStream));
it gives me this error
Error 1 'System.IO.Stream WindowsFormsApplication1.Form1.TCPChatApplication.getTcpStream()' has the wrong return type
|
|
|
|
|
ThreadStart() takes the name of a method that has no return type (i.e. is void) and takes no parameters.
Your getTcpStream method returns a stream.
Regards
David R
|
|
|
|
|
Thank you very much! finaly worked it out...
|
|
|
|
|
I want to pass "Huntington_Positions" into the function. How do I do that. a string will not work
ProcessFiles(fileInfo.FullName,"Huntington_Positions","dbo.Huntington_Position");
private static void ProcessFiles(string strFile, ? ,string strTable)
{
<br />
FileHelperEngine Fh1 = new FileHelperEngine(typeof(?)); <br />
bulkCopy = new SqlBulkCopy(SQLConnection);
bulkCopy.DestinationTableName = strTable;
Fh1.Options.IgnoreEmptyLines = true;
dt = Fh1.ReadFileAsDT(strFile);
try
{
bulkCopy.WriteToServer(dt);
}
catch (Exception Ex)
{
Console.WriteLine("ProcessFiles.bulkCopy: " + Ex.ToString());
}
}
--------------------------------------------------------
Its referencing a class file for the dll.
http://www.filehelpers.com/example_easy.html
|
|
|
|
|
I have no idea what a 'Huntingdon_Positions' is - but looking at here[^] (if this is what you're referring to, it's simply a class (SampleType in their docs).
You can't pass a class into a method, but you can pass a Type.
ProcessFiles(fileInfo.FullName, typeof(Huntington_Positions), "dbo.Huntington_Position");
private static void ProcessFiles(string strFile, Type type, string strTable)
{
FileHelperEngine Fh1 = new FileHelperEngine(type);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
|
When posting with errors/exceptions it's helpful if you indicate which line the exception occurred on!
Anyway, you didn't change the FileHelperEngine instanciation line as I suggested previously, so I guess the error is there.
Fh1 = new FileHelperEngine(typeof(type)); now needs to be
Fh1 = new FileHelperEngine(type); as you already have the Type in type - no need (and it won't compile) to do a typeof on it.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
my t1.txt is:
1
5
18
125
.
.
.
I want to read a specific value from txt file( sample 3.value that is 18)
using System;<br />
using System.Collections.Generic;<br />
using System.IO;<br />
<br />
class Program<br />
{<br />
static void Main()<br />
{<br />
const string f =(@"C:\t1.txt");<br />
<br />
List<string> lines = new List<string>();<br />
<br />
using (StreamReader r = new StreamReader(f))<br />
{<br />
string line;<br />
while ((line = r.ReadLine()) != null)<br />
{<br />
lines.Add(line);<br />
}<br />
}<br />
<br />
foreach (string s in lines)<br />
{ <br />
Console.WriteLine(s);<br />
}<br />
<br />
}<br />
}</string></string>
|
|
|
|
|
You could try using File.ReadAllLines[^] which returns an array of data from your file.
If you want to refer to specific line (for example 3 as in your post) you would simply use ...yourvariable[2]...
|
|
|
|
|
this means you want to read the value from line X?
you may implement a helper method wich takes the StreamReader and returns the value contained in a file at line X. use a loop to skip the lines and count them.
Calin
|
|
|
|
|
If you want a value from the specific line, you can simply count the lines and use the value from the correct one. Just like this:
string line;
int current_line = 0;
int desired_line = 3;
while ((line = r.ReadLine()) != null)
{
current_line++;
if(current_line == desired_line)
{
lines.Add(line);
break;
}
}
This is just a sample logic. I hope you can use something like that for your case.
|
|
|
|
|
|
To comment on this post, I'd write this code a little different and smaller, like this.
It maybe is just my style, but I think it's better:
int desired_line = 3;
for(int current_line = 0, string line; (line = r.ReadLine()) != null; current_line++)
{
if(current_line == desired_line)
{
lines.Add(line);
break;
}
}
|
|
|
|