|
|
That just shows how much floating point stuff I've done in .NET.
Thanks for the tip.
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"Get in touch with your Inner Capitalist - I wish you much success!" -- Christopher Duncan, Lounge 9-Feb-2004
|
|
|
|
|
|
Hey
I'm doing a project in which I'm using j# browser controls. Now I have a need to get some data from the database(SQL). But as j# browser controls runs on the client machine, how can I manage to connect to the database. The application must be on the internet.
I have some rough ideas as using "XMlHTTP" active x component, SOAP technology, using httpUrl from java.net class.....
I didnt study all these cases yet, also I'm not sure which will work efficiently, as I have to deal with very large database.
Will anyone please help me.......
Regards...
|
|
|
|
|
Is there a method in C++ .NET to emulate a real time loop while still using the managed forms editor?
while(true)
{
if(PeekMessage(msg, hWnd, 0, 0, PM_REMOVE)
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
fGameLoop();
}
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
I have two textboxes on a form and have the following code in the Leave event of one of them. The problem is that once the textbox has focus, you can't leave it if the textalign property has changed. I need a way around this without setting focus to the next control manually.
I still have to see if is framework or language related with the same code in C#.
HELP!!
Private Sub TextBox1_Leave(ByVal sender As Object, _<br />
ByVal e As System.EventArgs) Handles TextBox1.Leave<br />
<br />
If TextBox1.TextAlign = HorizontalAlignment.Left Then<br />
TextBox1.TextAlign = HorizontalAlignment.Right<br />
Else<br />
TextBox1.TextAlign = HorizontalAlignment.Left<br />
End If<br />
End Sub
|
|
|
|
|
when you change the textalign property, it will again set the focus to the current control(textbox in our example). So you should not change the alignment in the leave event...
If you explain your requirement in detail, I hope I would be able to help you clearly.
|
|
|
|
|
At a guess, the alignment is set to right by default, but on editing is set to left, then back to right in the leave event (somewhat erroneously).
The problem is most likely with the order of events.
When using the keyboard, the events are fired in the following order:
Enter
GotFocus (user enters data)
Leave (user has tabbed away)
Validating
Validated
LostFocus
When you use the mouse or call the Focus method, the events are fired in the following order:
Enter
GotFocus (user enters data)
LostFocus (user clicks on other control)
Leave
Validating
Validated
So, if you handle the Enter and LostFocus events, what you want works when using the keyboard. If you use the likely pairs together (like Enter and Leave), when you change the TextAlign property the handle for the text control is recreated. If it had the focus (which for keyboard events, it still does) the focus is again set to the TextBox.
The trick is to change the alignment at the correct time based on whether or not a mouse button was clicked:
// Hook-up event handlers.
myTextBox.Enter += new EventHandler(myTextBox_Enter);
myTextBox.Leave += new EventHandler(myTextBox_Leave);
myTextBox.LostFocus += new EventHandler(myTextBox_LostFocus);
// Handle events.
private void myTextBox_Enter(object sender, EventArgs e)
{
myTextBox.TextAlign = HorizontalAlignment.Left;
}
private void myTextBox_Leave(object sender, EventArgs e)
{
if (Control.MouseButtons != MouseButtons.None)
myTextBox.TextAlign = HorizontalAlignment.Right;
}
private void myTextBox_LostFocus(object sender, EventArgs e)
{
if (Control.MouseButtons == MouseButtons.None)
myTextBox.TextAlign = HorizontalAlignment.Right;
}
Hope this helps
Steve S
(One of these days I really must start using this stuff properly...)
|
|
|
|
|
I am experiencing a very strange problem while trying to set the value of a public field in a class that is being accessed using .NET remoting. Assuming the following definitions:
public enum BuildMethod {
DropBox,
CVS,
}
public class BuildInfo : System.MarshalByRefObject {
/// <remarks>
public BuildMethod Method;
...
}
The problem occurs in my client when I am trying to set the value of the Method field of BuildInfo, i.e.:
xxxx.Method = BuildMethod.DropBox;
There does not appear to be a problem retrieving the value of the Method field, but only when I try to set it.
Exception Details:
System.Runtime.Remoting.RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod.
Stack Trace:
[RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +264
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +877
System.Object.FieldSetter(String typeName, String fieldName, Object val) +0
Matrix.ProductMgmt.DeliveryMethodEditor.Save_Click(Object sender, EventArgs e) in D:\Matrix\WebApp\Application\ProductMgmt\DeliveryMethodEditor.ascx.cs:116
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +108
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277
I am setting up the channel on the server side like this:
System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider SinkProvider =
new BinaryServerFormatterSinkProvider();
SinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = 10782;
this.ServiceChannel = new TcpChannel(props, null, SinkProvider);
ChannelServices.RegisterChannel(this.ServiceChannel);
I am making the object available on the server side using RemotingServices.Marshal().
I would appreciate any help or suggestions that anyone can provide. Thank you,
Clark Laughlin
|
|
|
|
|
Try using Marshal by value.
|
|
|
|
|
Do you have any more details? I've tried setting SerializableAttribute on the enum. Is there more that is needed?
Thank you in advance for your help,
Clark L
|
|
|
|
|
I have a really frustrating problem, and some googling has revealed that I'm
not the only one. Its quite easy to reproduce:
1. Create a .Net C# project with a usercontrol and a forms application
2. Build the solution (debug) and add the usercontrol to the form's toolbox
3. Drag a usercontrol from the toolbox into the form
4. Close the form
5. Select the "Release" configuration
6. Open the form
Now the user control is gone with all its related code!
I know this is happening because the usercontrol .dll does not exist in the
release configuration, but is deleting sourcecode really expected behaviour?
Am I doing something wrong?
Christian Skovdal Andersen
Don't mention the war...
|
|
|
|
|
I am writing a program that interfaces with Flight Sim 2002 and 2004. I am writing this in .NET VC++ 7. I have one 100ms timer, and I am currently testing the program with only one funtion call. Every 100ms if a few variables are met the program accelerates the aircraft (writes a new velocity value to FS). That's the theory... in reality it only writes about once every 2-3 seconds or so. How can I make the program run faster, at a higher cpu priority, or whatever?
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Timers produce too much background activity, you can use a thread instead.
//replaces timer.Enabled = true;
Thread t = new Thread(new ThreadStart(timerMethod));
t.start();
//replaces timer_OnTick
private void timerMethod(){
doSomething();
Thread.CurrentThread.Sleep(100);
}
|
|
|
|
|
Hello,
I am trying to use Raw Sockets in C# but without much success. I would like to create a server process using raw sockets allowing clients to connect as a TCP connection. However, I cannot seem to get clients to connect in this way.
A second thought I had was to set up a normal socket for the connection phase (The initial handshaking) then continue the communications with the Raw Socket. However this does not work either. The packet does arrive at the destination machine, however the client application doesn't seem to see it.
Does anyone have any ideas of what I should be doing?
Cheers,
Andy
|
|
|
|
|
I've just tried to rebuild a library that was created in Visual Studio 6.0 in .NET Enterprise Architect. I got the following error.
Error C3861 GUID_NULL identifier not found, even with argument dependent lookup. Apparently the error is in the atlcomcli.h header file.
Any ideas?
|
|
|
|
|
Hi there,
I recently switches from VS 6 to VC++ .net, and found that the class wizard does no longer support to create CDaoRecordsets. I found some info on the net, but none explaining exactly why that is so and providing good alternatives. I am actually not developing .net applications, just doing some dialog based stuff with interaction to an MS Access databases.
So what would be the alternatives to CDaoRecordset and why is it no longer included ? Respectively, should I derive my CDaoRecordset classes for my database under 6.0 and then import them into the .net developer studio or will this have drawbacks?
thanks
ch
|
|
|
|
|
Don't go there.
DAO is a deprecated technology - we switch to ADO or for C++, you can use OLEDB. There are some spiffy ATL wrappers.
Generally, this will give you an 'as capable' system, and provide you with the possibility to upsize to SQL Server or ORACLE.
Steve S
|
|
|
|
|
Are there known performance issues when writing C++ code in .NET. I am working on a program that retrieves the data from MS Flight Simulator every 100 mS, but it doesn't seem to update but once every 3 or 4 seconds. I am having many issues with the window not completely drawing after being minimized (it comes back when I threaten to close it (right click on the taskbar icon)). I have heard there are performance issues with .NET that never seemed to be a prob in VC++ 6.0. Anyone know anything?
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Your problem is most probably with the type of a timer that you are using. And your redrawing problems are probably thread related. You should really be using threads and the Timer type provided in the System.Threading namespace. Also if you will be planning to update the UI of your application from the code running on another thread you need to be using Delegates as most of the methods of types in the System.Windows.Forms namespace are not thread safe. Post some of your code and people might be able to help you a little bit more.
|
|
|
|
|
Noticed something odd with this property of the ComboBox control. If the SelectedIndex is greater than zero and I attempt to set it to -1, the value instead changes to zero. If the value is already zero, it will change to -1.
Any idea why/how it behaves like this?
>>>-----> MikeO
|
|
|
|
|
Is it Windows forms or Web forms?
In Web forms selectedindex can never be set to -1 as the indexing starts with 0 always.
If it is windows forms can you post the code snippet?
|
|
|
|
|
Hello everybody,
I am new in the .NET environment.
I developed Remoting components running on a desktop (with .NET *regular* framework)
I have a couple of industrial PDAs running Win CE .NET 4.1 that need to connect and use these 'desktop' components over a WLAN (wifi LAN).
Obviously the compact framework does not support Remoting.
What should I do?
Any hint is highly appreciated !
Sincerely,
Bertrand
|
|
|
|
|
i was wondering what the code was to invoke a click event to highlight the item in the listbox when you right click. Im just using this to pull up a context menu but i want the item to be selected. Simple solution i hope.
|
|
|
|
|
Try this...
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown<br />
Dim item As Integer<br />
For j As Integer = 1 To ListBox1.Items.Count<br />
Dim rect As System.Drawing.Rectangle = ListBox1.GetItemRectangle(j - 1)<br />
If rect.Contains(e.X, e.Y) Then<br />
item = j - 1<br />
Exit For<br />
End If<br />
Next<br />
ListBox1.SelectedIndex = item<br />
End Sub
|
|
|
|