|
We apparently posted at the same time, however I must have beaten you by mere seconds.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Thanks guys,
Well this seems to be my only option - I was hoping to find a "cleaner" solution since my form is already so cluttered. I have searched endlessly but i can't seem to find any other way besides a button. Looks like i will have to go with the button. Thank for the help.
Gavin
|
|
|
|
|
Another option that comes to mind is using a ContextMenu. For example this could be displayed after right-clicking your TextBox and contain the MenuItem "Clear Date". After clicking the MenuItem the TextBox is cleared.
Never you really worked with ContextMenus so I can give no further help. But I think it's worth a try and shouldn't be that complicated
www.troschuetz.de
|
|
|
|
|
Does anyone know if you can turn off the automatic vertical and horizontal scrollbars on a DataGrid? There seems to be no AutoScroll property.
Thanks!
Mark
|
|
|
|
|
Try something like the following:
[DllImport("user32.dll")]
static extern bool EnableScrollBar(IntPtr hWnd, int wSBflags, int wArrows);
private const int SB_BOTH = 3;
private const int ESB_DISABLE_BOTH = 0x3;
EnableScrollBar(dataGrid.Handle, SB_BOTH, ESB_DISABLE_BOTH);
- Nick Parker My Blog | My Articles
|
|
|
|
|
I am looking to use COM+ transactions in my C#/VB back office application.
I have a form that collects client company details, address, contacts (the usual)
I have create components that allow me to add each of the above to the database in its own transaction, but I want them all to participate in the same transaction. The com+ components will be hosted on a remote server.
From my c#\vb form how do i get these to participate in the same transaction, any help would be appreciated.
|
|
|
|
|
Hi all,
did anybody experience problems after installing .NET 1.1 SP1?
First thing I noticed is that the text of goupboxes that are in an other groupbox is messed up(seems like the wrong font), when using visual styles.
The other thing is that I now get weird exceptions from the Windows.forms stuff, e.g.
Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
or
Object reference not set to an instance of an object. at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
or
Object reference not set to an instance of an object. at System.Windows.Forms.WndProc.Invoke(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
Does anybody have similar problems?
This ServicePack really sucks!!!
Best Regards
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
I haven't had any problems with it.
You didn't mention when you installed it, so forgive me for the is-it-plugged-in level question, but have you restarted your computer? Installing the service pack and running a .NET app without restarting first can cause all sorts of obscure exceptions in the framework.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Haven't had any problems like your having. Actually, I haven't had any problems at all! It's actually fixed a couple of problems that I ran into with the Garbage Collector and VERY large object allocation.
Are you overriding WndProc in your app? What are you doing in your override?
What are you doing in the Load event of your Form? Also, are you checking to see if your controls actually have handles before doing anything with the handles?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
These problems occur on different computers. But they only appear if you install the .NET ServicePack.
For e.g. the "Error creating window handle" message occurs sometimes when my form calls the ShowDialog method.
But why should there be a problem now. It works fine if the ServicePack is not installed!
Well, ProjectManagement decided that our Software won't officially support the .NET Service Pack...
Best Regards
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
i want to make a panel slide like the .net toolbars? can ne 1 give me some great looking code;) thanks?
|
|
|
|
|
i've implemented this by using Timers
Basically, the idea is something like this:
- Event is fired (Button click lets say)
- Start Timer
- On timer tick, resize/move control
- Once control reaches appropriate size stop timer
You can tweak the speed of your timer intervals to get a decent animation going.
I am sure there is a better way to do this using DirectX.
Jon G
www.Gizmocoder.com
|
|
|
|
|
Hi there, i have a trie to invoke a method via reflection from Events.dll (the method that tries to create an instant of the class containing the method also resides in Events.dll)
invoking method is :
private void execute(string actionname,string[] parameters){
Assembly a = Assembly.LoadFrom("Events.dll");
Type[] ts = a.GetTypes();
Type t=a.GetType("IOW.NET.Events.StartProgram");
MethodInfo runmethod = t.GetMethod("run");
object obj=Activator.CreateInstance(t);
runmethod.Invoke(obj,parameters);
}
Class StartProgram looks like this:
namespace IOW.NET.Events
{
public class StartProgram: Event
{
public StartProgram(){}
public void run(object[] parameters)
{
//do something
}
}
}
My Programs interrupts working when i call
runmethod.Invoke(obj,parameters);
any ideas where the error is? i just can´t find it.
Events.dll is in the right directory, otherwise it would give me an error when i load the assembly from file.
i can also read all types from the Assembly-object without problems.
thanks for any hints
best regards
jkersch
|
|
|
|
|
jkersch wrote:
any ideas where the error is? i just can´t find it.
I would suggest you put a check for null values along the way. Also, in particular, there is a overloaded method for creating a MethodInfo object that allows you to specify the BindingFlags via a bit mask, that could be your problem.
- Nick Parker My Blog | My Articles
|
|
|
|
|
What Nick said is the solution to the most likely problem. If run is not public, then you must use the overload with BindingFlags.NonPublic . If it's a static method, then you have to include BindingFlags.Static (perform a bitwise OR with flags). Using just GetMethod(string) uses BindingFlags.Public | BindingFlags.Instance .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
i finally found the error.
my (public) run-method wanted to have object[] Myparameters as argument.
i wanted to invoke it with methodobject.invoke(classobject,object[] MyParameters).
i wrapped the object[]-array my method uses in a second object[] array
i.e. methodobject.invoke(classobject,new object[]{object[] MyParameters});
and it worked out of the box,
thank´s a lot nevertheless,
jkersch
|
|
|
|
|
Hello
I have a problem with the following code. It gives an error saying that the OleDb could not be found. I have included using System.OleDb at the top of my form. But still get the error.
[code=vb]
cnnTeacher.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IBS Library System\LibrarySystem.mdb;Persist Security Info=False";
OleDbCommand cmdTeacher = cnnTeacher.CreateCommand();
cmdTeacher.CommandText = "Select * From Teacher Where TeacherID = txtIDNumber.text";
cmdTeacher.Parameters.Add("ID", OleDb.VarWChar, 40).Value = txtIDNumber.Text; //OleDb could not be found
OleDbDataAdapter daTeacher = new OleDbDataAdapter(cmdTeacher);
OleDbCommandBuilder cbTeacher = new OleDbCommandBuilder(daTeacher);
daTeacher.Fill(dtTeacher);
[/code]
Many thanks in advance,
Steve
|
|
|
|
|
I have just spent the last month fighting with OleDb, so you have my sympathy!
1) Have you tried "using System.Data.OleDb;" instead of "System.OleDb"? (If you're using VB.NET, doesn't it use the term "Imports" instead of "using"?)
2) Make sure the driver (in your case the MS Jet OleDb driver dll) has been installed on your system.
3) I have read that if you use a DataAdapter you do not need to do an explicit open on the connection (i.e. cnnTeacher.Open()), but if all else fails, I would give it a try.
Hope this helps!
|
|
|
|
|
Thanks for your help
I am using:
using System.Data.OleDb;
Opening the connection is not a problem.
But l am not sure about this OleDb driver dll, how would l know that I have it installed on my computer.
I hope you can help.
Thanks,
Steve
|
|
|
|
|
To determine if a driver is installed on your system, go to:
Control Panel,
Administrative Tools,
Data Sources (ODBC),
Select the "Drivers" tab.
If the driver is not listed, your best bet would be to download
and register the driver from Microsoft's site.
But, I think the problem could be punctuation ... there needs to be a semi-colon (";") on the inside of the ending quote mark of the connection string (as well as one outside the quote mark to end the command line). For example:
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=databaseName;";
If you are still having trouble, I would look at the "OleDb.VarWChar" variable in the Parameters statement where the error is occurring. I have not dealt with parameters, but I might hazard a guess that the the OleDb needs to be qualified (i.e. System.Data.OleDb.OleDbType.VarWChar). I have had items come up in intellisense, but did not run until qualified.
Hope this helps!
|
|
|
|
|
Hello,
Thanks for your help. I managed to find the answer. I don't need the line to add parameters. So l deleted it and made a few changes and now it works fine. Below is the correct code for your own review.
cnnTeacher.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IBS Library System\LibrarySystem.mdb;Persist Security Info=False";<br />
OleDbCommand cmdTeacher = cnnTeacher.CreateCommand();<br />
cmdTeacher.CommandText = "Select * From Teacher Where TeacherID = '" + txtIDNumber.Text + "' ";<br />
<br />
OleDbDataAdapter daTeacher = new OleDbDataAdapter(cmdTeacher);<br />
OleDbCommandBuilder cbTeacher = new OleDbCommandBuilder(daTeacher);<br />
<br />
daTeacher.Fill(dtTeacher)
steve
|
|
|
|
|
Hi,
As a newbie, I was interested to read this article about creating a User Control.
support.microsoft.com/default.aspx?scid=kb;EN-US;323116
I copied the code from the webpage, compiled the user control code into a DLL, compiled the sample client application, and the progress bar worked fine.
I then started to tinker with it, and I found that my code did not work in all situations. I found that although the provided sample code drew the Progress Bar OK in the timer1Tick event handler, my button2Click event handler needed to call the Refresh method of the User Control. Without the refresh, the progress bar would not move at all until the "for" loop had finished, when it simply filled the whole bar. There was no progress at all, let alone smooth progress
The code I added to the sample on the MS site is below. Anyone know why this does not work without the Refresh? I'm guessing that maybe it's do do with the fact that in the supplied code, the Value is incremented once per event, whereas in my code, the increment from 1 to 100 is all in one event, and the repaint only occurs when the event handler completes. As I say, that's only a guess though.
Thanks in advance for any enlightenment.
Gary.
Here are the two Event Handlers.
void button2Click(object sender, System.EventArgs e)
{
for ( int i = 0; i <= 100; i++)
{
this.userControl12.Value = i;
// WHY DOES THIS NEED A REFRESH???
this.userControl12.Refresh();
}
}
void timer1Tick( object sender, EventArgs e )
{
if (this.userControl11.Value <= 100)
{
this.userControl11.Value++;
// BUT THIS DOESN'T???
}
else
{
this.timer1.Enabled = false;
}
}
|
|
|
|
|
|
This has to do with when Windows decides to repaint your form. Windows does not repaint until your application is idle. You have seen this before with programs that do heavy processing. Have you ever used a program and all the graphics went to a white screen, and you end up having to wait a few seconds to get the graphics back? That's the same principle. Here you are forcing the graphics to refresh on your own, without waiting for it to be called automatically by Windows. If you take out the refresh,then when you exit the button2click function, Windows calls a refresh automatically on your usercontrol, but by then the value is 100. So what you see is the progress bar at 100.
|
|
|
|