|
Windows Forms (at least in .NET 1.0) does not allow that. You'll need to use a library such as Lutz Roeder's CommandBar for .NET[^].
Cheers,
Arun
|
|
|
|
|
How can I access MySQL from C# without using stuff that I have to configure outside of my program? (The tutorials I see require me to configure ODBC for example)
I want to be able to just enter the address in my program and connect to it, but I see no easy functions like mysql_connect() or so...
|
|
|
|
|
SourceForge.net has a project that is developing a managed MySql provider.
|
|
|
|
|
I've looked everywhere to try and find out how to print decent images.
I've used a few programs which seem to be programmed in Delphi, and have asked the programmers if they do anything special when loading or printing and the answer is NO.
So why can't I get the same quality printing when using C#, the images are the right size from the start, so I just shove them into the printpage and fire them out to the printer.
The program is for printing CD covers, and the text etc is just not sharp.
Can anyone Please help, I'm a newbie and at a total loss at where to loko next.
|
|
|
|
|
I've been wondering whether VS.NET 2002 projects will work in VS.NET 2003. Will it need to go through some kind of a conversion process or something like that?
|
|
|
|
|
I think it's best to just open your 2002 projects in 2003 and recompile them... I found that Microsoft didn't change much of their methods' parameters or functions, just added some new stuff to the .NET framework...
|
|
|
|
|
The .csproj file format is upgraded, and VC#.NET 2K3 will automatically prompt when you open a C# 2K2 project.
|
|
|
|
|
VB.NET and C# projects will go fine. The only trouble will be with C++ projects, because there were some language changes, but not a big deal.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
We know the default TCP/IP port of SQL Server 2000 is 1433.
I can connect to DB from remote using SQLConnection class. But when the default port is changed, I couldn't.
How can I connect to DB with different TCP/IP port?
|
|
|
|
|
Hi mkomasi,
I have'nt tried much on SQL Server. Although, you may like to try http://www.connectionstrings.com/[^] for a variant of ConnectionString that can faciliate connecting to a different port. Alternatively, does OLEDB allow that? A suitable connectionstring should help you there too? Try that URL.
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
The content of the textbox is a pathname.
I want to change the path and then press
"save as default" -> now the default path
should be the new one (even after restarting)
Is this possible?
thanks and regards
markus
|
|
|
|
|
Yes, search on "Dynamic Properties", you can bound the Text property of your TextBox to a config file.
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
yes that seems to work
but when i try to save the new path i get an exception:
"Collection is Read Only"
my code:
private void button1_Click(object sender, System.EventArgs e)
{
Configuration.ConfigurationSettings.AppSettings.Set
("textBox1.Text", newPath);
}
thanks and best regards
|
|
|
|
|
Hi all...I'm writing a small program (learning C#....yes I'm a beginner). I am using the RichTextBox control that the users can enter or paste in some text. Then afterward, I want to go through that text in the control character by character and be able to determine each characters font style, size, etc.....
Can anyone point me in the right direction for that? I was able to set fonts, etc... correctly (giving them a context menu to do a few things), when its all said and done I want to parse the style, character by character.
Help Please! Small example, or web page example, or even a pointer as to what methods to start with would be helpful.
Thanks.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
For finer control over richtext, you can serialize the contents to a file or string and then parse it individually using the RT file format, you can get the format from wotsit[^]
- Kannan
|
|
|
|
|
I have a weblog thing I made in C#, ASP.NET, it works fine and everthing and stores each entry into and .xml file. Now usually I edit and make new entrys though internet explorer, but then I though how cool would it be to make an application in C# to take the .xml file edit it in the program, then click the save button and have it update the .xml!
Does anybody have any tips or places to look, for help on this???
/\ |_ E X E GG
|
|
|
|
|
|
Thanks for the effort, but that's not what I really wanted... dont' worry about it....
/\ |_ E X E GG
|
|
|
|
|
...
Prepare for confusion, but please help.
I have a plugin framework, using reflection.
This works brilliantly and I will release the code eventually. However, one of the plugins is calling an async callback. This throws an invokation exception:
Cannot load type GoogleSearch.GoogleSearchForm, GoogleSearch, Version=1.0.1212.26393, Culture=neutral,<br> PublicKeyToken=null. at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod()
at System.Runtime.Remoting.Messaging.MethodCall..ctor(IMessage msg, Boolean needAccessCheck)
at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem..ctor(IMethodCallMessage message, AsyncResult ar, Object target)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at GoogleSearch.SearchDelegate.BeginInvoke(String url, String& result, AsyncCallback callback, Object object)
at GoogleSearch.GoogleSearchForm.search_Click(Object sender, EventArgs e) <br>in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screenmate\googlesearch\google.cs:line 219
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods<br>+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at GoogleSearch.GooglePlugin.LoadGoogleForm()<br> in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screenmate\googlesearch\google.cs:line 36
Now, let me tell you how the app works. The main app gets methods via reflection. And in the end get to this point:
object o = Activator.CreateInstance(t);
MethodInfo mi2 = t.GetMethod("AcceptRect");
Rectangle rect = new Rectangle(this.Location,this.Size);
mi2.Invoke(o,new object[]{rect});
Now that works fine on all plugins, including the troublesome one.
Now in the plugin class, there is a call to another class in the plugin dll. One based on a windows form. The form loads ok.
A button on the form starts an async callback to process some data. NOW THIS DOESN'T WORK.
GoogleSearch.GoogleSearchForm gs = new GoogleSearch.GoogleSearchForm(this.bob);
gs.ShowDialog();
The above opens the form. (This is all within the same dll and namespace)
SearchDelegate search = new SearchDelegate(this.Search);
string result;
search.BeginInvoke(url, out result, new AsyncCallback(this.AnnounceSearch),search);
public delegate string SearchDelegate(string url, out string result);
public string Search(string url, out string result)
{
ArrayList ar = new ArrayList();
Uri uri = new Uri(url);
WebRequest wr = WebRequest.Create(uri);
WebResponse resp = wr.GetResponse();
Stream s = resp.GetResponseStream();
StreamReader sr = new StreamReader(s);
string t = sr.ReadToEnd();
sr.Close();
return (result = t);
}
public void AnnounceSearch(IAsyncResult iar)
{
SearchDelegate search = (SearchDelegate)iar.AsyncState;
string result;
search.EndInvoke(out result, iar);
this.panel1.Controls.Clear();
MakeControlsDelegate del = new MakeControlsDelegate(MakeControls);
this.Invoke(del,new object[]{result});
}
public delegate void MakeControlsDelegate(string t);
public void MakeControls(string t)
{
ArrayList gr = this.ParseGoogle(t);
foreach(LinkLabel ll in gr)
{
this.panel1.Controls.Add(ll);
}
Ok, I think thats everything now...
Anyway, the above code WORKED PERFECTLY when it was not a plugin and was just a compile time dll.
The only thing i've changed is the fact that the form is being run from a late-binding dll.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
You are likely having a threading issue. Try as the AsyncCallback is invoked from another thread. Do the following:
from your control:
Invoke(mi.Invoke, new object[]{o, new object[]{rect}});
Eek. Dunno if that will work, but give it a try
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
I'm not sure I understand where i'm to place that.
The plugin is activated and invoked from a form in the main app and main thread.
From the new instance of the plugin, the plugin class loads the plugin form.
object o = Activator.CreateInstance(t);
MethodInfo mi = t.GetMethod("SomeMethod");
mi.Invoke(o,null);
does the above code create the instance of the object in a new thread, or the same thread as the method that runs it?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Jonny Newman wrote:
does the above code create the instance of the object in a new thread, or the same thread as the method that runs it?
That will create the object in the calling thread.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Jonny Newman wrote:
Anyway, the above code WORKED PERFECTLY when it was not a plugin and was just a compile time dll.
The only thing i've changed is the fact that the form is being run from a late-binding dll.
Just judging from that I would say there is a problem with the application resolving assemblies.
In the FrameworkSDK\bin directory (located within VS.NET's install folder) you'll find FUSLOGVW.exe which will let you see what the runtime is trying to do to find the assemblies it needs to load.
Run that, make sure you check the "Log Failures" checkbox, then run your application. You should see where it is expecting to find the assemblies it is loading, and if it fails to load an assembly the plugin depends on.
HTH,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll
Running under executable C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\ScreenMate.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:LOG: Attempting download of new URL file:LOG: Attempting download of new URL file:LOG: Attempting download of new URL file:LOG: All probing URLs attempted and failed.
Well, it seems to state that the dll was never loaded.
However, the dll must have been loaded because the form the button is on is in that dll, code is actually being run from it. It is definately something to do with the async callback.
Should I try starting the Activator.CreateInstance() in another thread?
Threading isn't my strong point.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
I don't think your problem has to do with threading. It doesn't matter on which thread you are trying to create the object, the CLR cannot find the assembly file that the object is defined in.
Which files do you have as part of your application? Presumably you have an application exe and the GoogleSearch.dll is the plugin.
Is the GoogleSearch dll located at any of the locations in the output above? If so is the dll of the same version listed above (i.e. 1.0.1212.29205)?
Regards
Mark Smithson
|
|
|
|
|