|
|
Hi,
Is it possible to set the file version to dynamically generated vb 6 exe in C#?
Any links/source code would be a great help.
Thanks in advance
|
|
|
|
|
Hi guys,
I got a Oracle store procedure which would return dataset using a ref cursor,it's quite easy to get the result set if I use the classes in System.Data.OracleClient because there's a type OracleType.Cursor which matches the procedure parameter's type.
But is it possible to do this via ODBC? There isn't a type likes 'OdbcType.Cursor'.
Anything you can help it would be appreciated.
|
|
|
|
|
Hi,
I need to work with Excel via C#, but I'm having problems getting started. Keeping it simple to start, I'd just like to open a new Excel workbook.
MSDN describes using code like this:
objExcel = new Excel.Application();
objBooks = (Excel.Workbooks)m_objExcel.Workbooks;
objBook = (Excel._Workbook)(m_objBooks.Add(m_objOpt));
Yet Excel is not recognized by the compiler, which I'm assuming is because I haven't exposed the right namespace.
I'm not sure what that would be. Intellisense is not offering Excel as an option anywhere I've looked. Elsewhere I've heard about using ADO.NET, but haven't seen anything I can get to work.
If anyone has worked with Excel via C# I'd appreciate any guidance...
Thanks,
Jeff
|
|
|
|
|
you have to use the name space :
using Microsoft.Office.Interop.Excel;
And this helps to open the excel:
Microsoft.Office.Interop.Excel.Application m_objExcel;
Microsoft.Office.Interop.Excel.Workbooks m_objBooks;
Microsoft.Office.Interop.Excel._Workbook m_objBook;
Microsoft.Office.Interop.Excel.Sheets m_objSheets;
Microsoft.Office.Interop.Excel._Worksheet m_objSheet;
Microsoft.Office.Interop.Excel._Worksheet m_objSheetIntro;
Microsoft.Office.Interop.Excel.Range m_objRange;
object m_objOpt = System.Reflection.Missing.Value;
m_objExcel = new Microsoft.Office.Interop.Excel.Application();
m_objBooks = (Microsoft.Office.Interop.Excel.Workbooks)m_objExcel.Workbooks;
m_objBooks.Open("Your excel file path here", m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt);
Padmanabhan
|
|
|
|
|
Hi,
Thanks for your reply. For some reason my compiler is not recognizing the Office part of the namespace.
If I use Intellisense after Microsoft it gives me [Contracts, Csharp, Internal, SqlServer, VisualBasic and Win32.] Not Office.
I'm using C# Express. Could that be the problem. Maybe I need a higher level version?
Jeff
|
|
|
|
|
no, just you have to add references..
1) rightclick your solution file.
2)click add reference.
3)add the reference file.
Padmanabhan
|
|
|
|
|
Hi,
Again, thanks for your replies.
It's a minor miracle, but at least the system is recognizing the namespace. I'm not sure what has changed since numerous times I tried different combinations of Excel Object refs and Office Object Library refs (earlier/later versions).Nothing seemed to work.
I tried one last time by deleting as many refs as possible and referencing only Excel 11.0 Objects. Suddenly it worked. I'm saving this as-is and will experiment later to see if I can replicate the bug.
Thanks,
Jeff
|
|
|
|
|
Hi,
Okay, I added two references: Office 12.0 and Excel 11.0.
So now the compiler recognizes *Office* but claims never to have seen *Interop*
The article called *Excel Interop Use in C#* by Sam Allen amazingly doesn't mention where you would find these references.
I'm seeing the solution you've described crop up on the net but I'm really not seeing how to wake up the compiler and get it to smell the namespaces.
Jeff
|
|
|
|
|
Now I want to create a self-extractor file use ICSharpCode.dll,but I only know create a zip file's suffixname with .zip,How to create a file's suffixname with .exe?a self-extractor file,Thanks.
|
|
|
|
|
Well, have you asked the people who create this dll ? Why do you assume it's possible ? It may well not be.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
uh,It's a open source dll,so many people use it,I don't know it can create a self-extractor or not,but I think it can do it. Jesus,my english is too bad.
|
|
|
|
|
Oliver Misear wrote: uh,It's a open source dll,so many people use it,
Yes, sure. But, if you come to a place that's not dedicated to this library, only SOME people here will use it. Everyone on a forum for that library, will use it. The docs will also tell you how to use it. Surely they have documentation ?
I typed your question in to google and found this thread.
http://www.eggheadcafe.com/community/aspnet/2/15981/switch-over-to-sharpzipli.aspx[^]
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
usually you have a tool which produce an exe with a well known fix size.
then you have a tool which append a compressed zip to the exe file
then, when run, the exe file will remove its extra data file and unzip it!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi im trying to use a c# dll i found here for telnet scripting . Ive added it to the reference's and its showing up in the object browser correctly but when i try the following code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telnet;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ScriptingTelnet.Connect();
}
}
}
I get the exception
Error 1 An object reference is required for the nonstatic field, method, or property 'objActiveSolutions.ScriptingTelnet.Connect()' C:\Users\Shuttle\Desktop\test1\test1\Form1.cs 21 13 test1
Im pretty new to c# but ive all ready added the reference with using Telnet; can anyone tell me how to use this c# dll ?
|
|
|
|
|
I think you need to learn some basic C#. The error means what it says. You need to create an instance of the object, to call an instance method.
ScriptingTelnet st = new ScriptingTelnet();
st.Connect();
at a minimum. But, if you don't learn some C#, you're just going to keep coming to grief.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks to some help in another thread I found out the reason an audio app is not working on some machines is because it requires the managed version of DirectX, which is not installed on most computers. Is there a known-good way to detect managed DirectX, specifically DirectSound? I know where the files are stored on the machines we've checked so far, but it would be nice to have something a little less haphazard.
|
|
|
|
|
It's suppose to login to this site here:http://www.govconnection.com
The problem is it gets redirected..
I have NO clue on this one.
I'm hoping someone's talented enough to handle this.
public void loginToSite()
{
string formUrl = "http://www.govconnection.com/IPA/Account/Login.htm";
string formParams = "__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUJNjYxOTQ0NzIyD2QWAmYPZBYCAgYQFgIeCG9uc3VibWl0BRxyZXR1cm4gQ29tcGxldGVBc3luY0NhbGxzKCk7ZBYCAgcPDxYEHghDc3NDbGFzcwUNc2l0ZUNvbnRhaW5lch4EXyFTQgICZBYEAgEPDxYEHwEFI2ZhdXhDb2x1bW5XcmFwIGNsZWFyIHdpdGhCYWNrZ3JvdW5kHwICAmQWAgIBDw8WBB8BBQdjb250ZW50HwICAmQWBgIBD2QWBgIBDxYCHgdWaXNpYmxlaBYEAgEPFgIfA2hkAgMPDxYCHwNoZGQCAw9kFgICAg8QZGQUKwACMtMBAAEAAAD%2F%2F%2F%2F%2FAQAAAAAAAAAMAgAAAEBJUEEuV2ViLCBWZXJzaW9uPTUuMC42MTEuMSwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAuSVBBLldlYi5VSS5Db250cm9scy5Ecm9wRG93bkxpc3RzLkRyb3Bkb3duSXRlbQQAAAAGX3ZhbHVlBV90ZXh0CV9zZWxlY3RlZBRfSXNUcmFja2luZ1ZpZXdTdGF0ZQEBAAABAQIAAAAGAwAAAAAJAwAAAAAACwL%2F%2F%2F%2F%2FD2QCBQ8WAh8DaGQCBQ9kFgICAQ9kFgYCAw9kFgJmD2QWAgICD2QWAmYPZBYCZg8WAh4JaW5uZXJodG1sBRFGZWF0dXJlZCBQcm9kdWN0c2QCBQ9kFgJmDw8WAh8DZ2QWCgIDDw8WAh4PVmFsaWRhdGlvbkdyb3VwBQh2YWxMb2dpbmRkAgUPDxYCHwUFCHZhbExvZ2luZGQCBw8PFgIfBQUIdmFsTG9naW5kZAIJDw8WAh8FBQh2YWxMb2dpbmRkAh0PDxYCHwNnZBYCAgMPFgIfA2hkAgc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lQnV0dG9u&ctl00%24Content%24ctl04=0&ctl00%24Content%24ctl00%24emailAddressTextBox=EMAILGOESHERE&ctl00%24Content%24ctl00%24passwordTextBox=PASSWORDGOESHERE&ctl00%24Content%24ctl00%24loginImageButton.x=0&ctl00%24Content%24ctl00%24loginImageButton.y=0&ctl00%24_leftColumn%24ctl00=&ctl00%24_header%24txtProductSearch=Item%23%2C+MFG%23+or+Keyword";
string cookieHeader;
System.Net.HttpWebRequest req = (HttpWebRequest)System.Net.WebRequest.Create(formUrl);
req.AllowAutoRedirect = true;
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(formParams);
req.ContentLength = bytes.Length;
using (Stream os = req.GetRequestStream())
{
os.Write(bytes, 0, bytes.Length);
}
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
String result = sr.ReadToEnd();
MessageBox.Show(result);
cookieHeader = resp.Headers["Set-cookie"];
}
|
|
|
|
|
I would say it has nothing to do with C#. I would expect that because you're doing a POST, the website itself is configured to redirect you.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
So does that mean, I can't work around this.
It's weird. If I post to the url handled by the form.. no login.
If I post to the url redirected to- no login.
?????
-Paul
|
|
|
|
|
What does the actual log in procedure look like to a real user? Does it redirect the user?
|
|
|
|
|
It may mean that, I'm not sure. I mean, I can think of exactly how I would write something to stop what you're doing.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian Graus wrote: I can think of exactly how I would write something to stop what you're doing.
Indeed, it does look like some sort of screen scraping application. You wouldn't want to have it running around inside a protected part of the application.
|
|
|
|
|
Paul Calabro wrote: The problem is it gets redirected..
Redirected to where?
By the way, have you tried setting up tools like Fiddler to examine the traffic while browsing in a regular browser to see what is actually happening. That way you can replicate reality, rather than guess at it.
|
|
|
|
|
I get redirected to their site (appears to use SSL)..
And I'm using Live HTTP Headers, a plugin for Firefox.
Here's a screenshot I JUST got back.
It looks like I'm collecting some session info... hmmm
http://i41.tinypic.com/2q9hrab.png[^]
|
|
|
|