Windows Forms in Windows Services
Hi , Is it possible to have Windows Forms in a Windows Service , I have tried
to do it but the application always locked .
Actually I am calling de .show method of the Form in the Onstart Event of
the service .
In the Microsoft documentation I can see that a windows service is a process
that does not have a user interface ; however when I used Visual studio 6.0 I
made services with an user interface ... How can I do this in .NET ... Or it
is not possible
Than you in advance. Tag: Loading (Running) EXE into GAC Tag: 92207
detecting the change in the cell of a datagrid
Hi
I am implementing DataGridTextBoxColumn in my Datagrid. I would like to find
out when the data in a cell belonging to this column style is changed. I
would like to format the contents say for instance to a currency if the
contents of the textbox are of numeric type.
I modified the following in the Commit function
Protected Overrides Function Commit(ByVal cm As CurrencyManager, ByVal
RowNum As Integer) As Boolean
'
' Parse the data and write to underlying record.
'
Me.HideEditBox() ' return focus to the DataGrid control
Dim box As DataGridTextBox = CType(Me.TextBox, DataGridTextBox),
Value As String
' Do not write data if not editing.
If box.IsInEditOrNavigateMode Then Return True
If TextBox.Text = "" Then ' in this example, "" maps to DBNull
SetColumnValueAtRow(cm, RowNum, DBNull.Value)
Else
' Parse the data.
Try
If ValidateContents(TextBox.Text) Then
Value = FormatContents(TextBox.Text)
Else
return false ' to retain the old value This is the
problem.
End If
Catch
Return False ' Exit on error and display old "good" value.
End Try
SetColumnValueAtRow(cm, RowNum, Value) ' Write new value.
End If
Me.EndEdit() ' Let the DataGrid know that processing is completed.
Return True ' success
End Function
Commit function is being called twice when I have the return stmt. If I take
it out the Value is nothing and I am losing the old value in the cell. Tag: Loading (Running) EXE into GAC Tag: 92206
Application.Run()
Does anybody know why some components like
Microsoft.DirectX.AudioVideoPlayback.Audio rely on the Application.Run
messaging system while other events in other classes dont?
Anyone got a reasonable way of testing that using NUnit as well?
Thanks in advance for any help offered.
Jax Tag: Loading (Running) EXE into GAC Tag: 92205
changed Property of Public Control a Designtime on UserControl disapears!
Hi,
I'm having some weird behaviour, and I can't find any solution to this.
I made a UserControl (uclCommands) which contains a Toolbar (ToolBar1) with
Modifiers = Public.
I put this usercontrol on my form and call it Ucl1. In the Property Window
in the Windows Forms Designer I change Ucl1.ToolBar1.ButtonSize to a bigger
value.
Everything goes fine: The buttons get the larger size. but after I compile,
the ButtonSize gets again the original size.....
Does anybody knows why this happens, and what I can do about it? I really
need this because my Usercontrol must have different sizes in my
application.
I tested this with Visual Studio 2005 beta 2 and VS 2003: Both the same
behaviour...
Any help or hints would be really appreciated!
Thanks a lot in advance,
Pieter Tag: Loading (Running) EXE into GAC Tag: 92204
NUnitForms - articles and tutorials?
Hello,
Where can I find articles and/or an online tutorial on using NUnitForms
for Windows forms?
dbuchanan Tag: Loading (Running) EXE into GAC Tag: 92202
databind with a combobox
Hi all,
I got a problem with binding an array of object with a combobox.
Here is my code:
public class Toto
{
public string Idr;
public string Name;
public Toto(string id, string name)
{
Idr = id;
Name = name;
}
}
... and the ui part:
Toto[] totoList = new Toto[3];
totoList[0] = new Toto("id1", "name1");
totoList[1] = new Toto("id2", "name2");
totoList[2] = new Toto("id3", "name3");
comboBox1.SelectedIndex = -1;
comboBox1.DataSource = totoList;
comboBox1.DisplayMember = "Name";
comboBox1.ValueMember = "Idr";
When the program reached the last statement (...ValueMember) I got an :
"Cannot bind to the new display member. Parameter name: newDisplayMember"
Someone knows why ?
Thx in advance Tag: Loading (Running) EXE into GAC Tag: 92200
How to restrict typing characters other than digit in TextBox in C
I am writing some winform application in C#.
I want my TextBox control have following properties:
1. accecpt inputing digits '0','1','2','3','4','5','6','7','8','9', and
display those digits in TextBox.Text as expect
2. If the user input something other than digits such as 'n', TextBox.Text
will not change but perform some operation as I wish.
How to program it.
Thanks.
AJang Tag: Loading (Running) EXE into GAC Tag: 92198
Draw line over richtextbox
Hi all,
Just want to ask help from you guys. I'm currently stuck with this problem:
I need to draw a line from richtextbox and connect it to a lable placed on
the form. I'm doing an application that has a similiar concept when you add
comments in ms word, there is a line connecting the text to the comments.
Thanks,
Jon Tag: Loading (Running) EXE into GAC Tag: 92193
Howto pass a cookie to a web browser
I have a windows application in vb.net which communicates with different
webservers. In some cases I want to start the internet explorer (or another
browser) with the current session. How can I pass the session cookie to the
browser? Tag: Loading (Running) EXE into GAC Tag: 92189
C# Listview subitems with checkbox/combobox
Hi,
I am using the listview in the grid format i.e Listview.View.Details.
I have a requrement where in I have to show checkbox and combo boxes in each
subitems. In other words there should be few checkbox columns and few
combobox columns in the listview. Currently I am able to show check box for
each item in the listview(i.e each row) but I need it for each cells.
Any help/suggestions is highly appreciated
Regards
Hitesh
hiteshsalian@yahoo.co.in Tag: Loading (Running) EXE into GAC Tag: 92185
Triggering a Control Event
This is probably a silly question, but is it possible to trigger a button
click event from inside the Form_Load event? I know I can just call the
Button_Click routine, but I'm not exactly sure how to setup the parameters.
Thanks in advance!
Jeff Tolman Tag: Loading (Running) EXE into GAC Tag: 92182
Control loaded in IE problem
I'm loading a control in IE. If the control is loaded from the server then
AppDomain.CurrentDomain.FriendlyName contains the URI of the server that the
page is from. If my control is loaded from the GAC on the client machine then
the FriendlyName is "Localhost". Is there a way to get the URI from within
the control.
I've used JScript to pass the document.domain into an OBJECT PARAM but this
requires me to change Security Settings to allow "Initialize and script
ActiveX controls not marked as safe". I'd like to avoid this whole issue.
-Steve Tag: Loading (Running) EXE into GAC Tag: 92181
Datagrid row selection
In windows explorer you can select multiple files using combinations of ctrl
and shift clicking, then if you click and hold the mouse button on one of the
already selected files you can drag all the selected files to wherever. I'm
trying to reproduce this kind of behavor in the datagrid, but the problem is
that when I click and hold the mouse button on an already selected row all
the other rows get cleared and only the clicked on row is selected! I thought
I could get around this by keeping track of all the selected rows,
intecepting the MouseDown event on an already selected row and then restoring
all the rows that are supposed to be selected using DataGrid.Select. However,
this doesn't seem to work. It appears that the rows get cleared *after* the
MouseDown event and, therefore, after my code to restore the selected rows.
This is very frustrating!
Does anybody have any ideas on how I can make this work? I have to restore
the selected rows while the user still has the mouse button down so that they
can drag them.
Thanks
WJ Tag: Loading (Running) EXE into GAC Tag: 92180
System.InvalidOperationException: Failed to load ImageList
I have seen talk of this around but none of them seem to be exactly my problem.
Anytime I compile the source of our application on my laptop I get the
following error when I run it:
System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. ---> System.InvalidOperationException: Failed to
load ImageList.
at System.Windows.Forms.ImageListStreamer..ctor(SerializationInfo info,
StreamingContext context)
...
This happens on anybody's computer who runs the program I compiled on mine.
If they compile the same program I did it runs fine on both my computer and
theirs.
I looked into this futher and noticed that the ResEditor can't even open the
.resources file generated when I compile the program. It fails to load the
imagelist resource.
What is the problem? It is as if the resource compiler is not serializing
the imagelist out correctly.
I already tried to do a repair install of Visual Studio 2003. I have a
Windows XP SP2 system on a dell laptop. Tag: Loading (Running) EXE into GAC Tag: 92178
MessageBox-Like Focus in a Custom Form?
I am writing a Windows Forms application that manages "Project" content on
CD-ROM and DVD media. If the end-user wants to Open a "project", I have to
prompt them to insert the media if it not already in the drive. Legacy
media contains a heinous Autorun routine that I must intercept. I can do
all of this without problem.
However, I can only intercept the Autorun event if I am the "Top" Form with
Focus. So, I want to display a message box with Cancel and Retry buttons
that also contains my custom code for intercepting the Autorun event.
How do I create a form (or a derived message box) that incorporates my
custom code while maintaining the insistent modality of the MessageBox? Are
there some simple properties that I can set on a normal form or simple way
to inherit from the standard MessageBox and add my own code?
Any advice or suggestions are greatly appreciated.
Carl Tag: Loading (Running) EXE into GAC Tag: 92174
TreeNode collapse method does not persist the state of the sub-nodes
Hi all,
I haven't been able to find any post regarding this problem...
the MSDN help about TreeNode.Collapse clearly says:
"The state of a TreeNode is persisted. For example, if the next level
of child nodes was not collapsed previously, when the Expand method is
called, the child nodes appear in their previously expanded state."
but what actually happens, is that all the sub node are collapsed as
well...is that the normal behaviour? how can I persist their state?
Thanks,
Amidan. Tag: Loading (Running) EXE into GAC Tag: 92170
Problem accessing VB6 .OCX file from VB.NET
Hello:
I am trying to access a VB6 OCX file (with many important methods in it
created by me) using VB.NET.
Let me tell you what I have done to access the methods.
I started with registering the OCX file using regsvr32 and registering
the ocx file. I tried to create an object using the NEW keyword but was
giving me an error saying that the method NEW was private and I cannot
access it outside.
So I upgraded the old VB6 project to .NET and it created a new .dll
file with a "New" method in it. So I could declare an object for that.
But whenever I start trying to access any methods in the OCX file I get
an exception saying "InvalidActiveXStateException". If I debug step by
step, I dont get that exception and but I dont get correct results from
the methods.
"Register for COM Interop" option is selected in the properties and I
also registered the new .dll file using regasm.But the methods still
donot work.
Please Help
Thanks in Advance. Tag: Loading (Running) EXE into GAC Tag: 92168
AxWebBrowser not firing events in production
Hi,
I can not get NavigateComplete2 and DownloadComplete events
from the object AxSHDocVw.AxWebBrowser to fire on production.
I have tested on computers having Visual Studio.NET installed and
everything goes well.
But I tested on computers not having Visual Studio.NET under Windows XP
and has the framework and the events will not fire
code iam using
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using mshtml;
namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
///
public class Form1 : System.Windows.Forms.Form
{
public SHDocVw.WebBrowser_V1 ie;
// Declare a new ButtonArray object.
private System.Windows.Forms.Button button3;
private AxSHDocVw.AxWebBrowser axWebBrowser1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
ie = (SHDocVw.WebBrowser_V1)this.axWebBrowser1.Application;
this.ie.BeforeNavigate +=new
SHDocVw.DWebBrowserEvents_BeforeNavigateEventHandler(ie_BeforeNavigate);
this.ie.DownloadComplete +=new
SHDocVw.DWebBrowserEvents_DownloadCompleteEventHandler(ie_DownloadComplete);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.button3 = new System.Windows.Forms.Button();
this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
this.SuspendLayout();
//
// button3
//
this.button3.Location = new System.Drawing.Point(344, 152);
this.button3.Name = "button3";
this.button3.TabIndex = 2;
this.button3.Text = "button3";
//
// axWebBrowser1
//
this.axWebBrowser1.Enabled = true;
this.axWebBrowser1.Location = new System.Drawing.Point(128, 64);
this.axWebBrowser1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
this.axWebBrowser1.Size = new System.Drawing.Size(300, 150);
this.axWebBrowser1.TabIndex = 3;
this.axWebBrowser1.Enter += new
System.EventHandler(this.axWebBrowser1_Enter);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(504, 414);
this.Controls.Add(this.axWebBrowser1);
this.Controls.Add(this.button3);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void axWebBrowser1_Enter(object sender, System.EventArgs e)
{
object o = "about:blank";
axWebBrowser1.Navigate2(ref o);
}
private void ie_BeforeNavigate(string URL, int Flags, string
TargetFrameName, ref object PostData, string Headers, ref bool Cancel)
{
MessageBox.Show("before nav");
}
private void ie_DownloadComplete()
{
IHTMLDocument2 htmlDocument =
(IHTMLDocument2)axWebBrowser1.Document;
IHTMLElement body = (IHTMLElement)htmlDocument.body;
body.innerHTML = "hello";
body.style.marginTop = 0;
body.style.marginRight= 0;
body.style.marginLeft = 0;
body.style.marginBottom= 0;
MessageBox.Show("download complete");
}
}
} Tag: Loading (Running) EXE into GAC Tag: 92167
Form designer fails to load inherited form
I have a base form with a few controls, some methods, and some properties
that I inherit from to create three different form classes (in a VB.net 2003
solution, in a lib project along with program and deplyoment projects). When
I first wrote this, all worked just fine.
I created a new inherited form (using Add inherited form ...) and
immediately the newly created form plus any existing forms that inherit from
the same base form no longer display but give the error message, "An error
occured while loading the document. Fix the error, and they try loading the
documen again. The error message follows: Object reference not set to an
instance of an object." I assume that the form designer has failed somehow
when attempting to draw the form in the design mode. The newly created form
never displayed at all.
The base form (and others that don't inherit from it), however, display
without error. Removing the newly created inherited form from the project and
deleting it entirely has not fixed the problem; now I get this error with any
of the inheriting forms.
Yet, the application runs just fine. I tried the trick of closing all
[Design] tabs, and also completely restarting VS with no luck. I ran into
this once before and solved it by recreating the base and inherited forms
from scratch, a time-consuming excercise that I don't wish to repeat.
I am able to recreate a form inheritance example in a separate solution with
no problem, as well.
Does anyone have a fix or some ideas of what to look for?
Thanks,
DrJohn Tag: Loading (Running) EXE into GAC Tag: 92163
Form closing event
Hello,
Lets say I have a button whose click event closes the form by calling Close.
How can I tell if the form is closing from that button click or from hitting
the 'X' close button in the top right corner of the form, or by using Alt +
F4?
Thanks Tag: Loading (Running) EXE into GAC Tag: 92161
DB connection problem in attemp to load DataGrid from SQLServer DB
Hi All,
I'm trying to run Jeff Prosise's DataGrid example in Chapter 6 of
"Programming Microsoft .NET".
Jeff provided a MyComics.sql file which I've used in Query Analyzer to
create and populate a MyComics database in SQLServer 7.0 installed with NT
authentication. I verified that the table had been loaded correctly with a
Select statement.
IE displayed the following info:
============================
Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'sa'. Reason: Not associated with a trusted SQL Server connection.
Source Error:
Line 70:
"server=localhost;database=mycomics;uid=sa;pwd=xxxxx");
Line 71: DataSet ds = new DataSet ();
Line 72: adapter.Fill (ds);
Line 73: MyDataGrid.DataSource = ds;
Line 74: MyDataGrid.DataBind ();
Source File: f:\inetpub\wwwroot\DataGrid-Prosise.Comics.aspx Line: 72
================================
I exex out the password. I'm quite sure the password I had supplied was
correct for the "sa" account.
I suspect the problem is a conflict between my specification of NT
authentication and the example's use of the "sa" user.
Any ideas? Should I post this stuff in some security NG instead?
Thanks in advance,
Richard Tag: Loading (Running) EXE into GAC Tag: 92157
Multi Threading in Framework 2.0 Beta
Hi,
I have a form with some ComboBox controls on it. I am populating it on a new
thread in Framework 1.1. But it does't work with Framework 2.0 Beta. It says
"Cross-thread operation not valid".
What is the best way to do it in Framework 2.0.
Richard Tag: Loading (Running) EXE into GAC Tag: 92154
Why is the reason for this error
While I was playing with VB.NET windows application I came across one
particular error.
Purposefully I made a button array and try to add an event handler like a
normal button.
Please find the code below.
------------------------------------------------------
Public Sub Start()
Dim But2(2) As Button
But2(1) = New Button
But2(0) = New Button
But2(1).Text = "Age"
But2(0).Text = "Man"
AddHandler But2.Click, AddressOf clickNewbutton
End Sub
Private Sub clickNewbutton(ByVal sender As Object, ByVal evArgs As
EventArgs)
MessageBox.Show("Hello from the new Button" & sender.ToString)
End Su
-----------------------------------------------------------------------------------
During compilation instead of prompting an user error message IDE crashed
with following error
"Visual Basic .Net compiler is unable to recover from the following error:
System Error &Hc0000005& (Visual Basic internal compiler error)
Save your work and restart Visual Studio .Net"
What is the reason for this compiler error?
JACOB P. JOJAN (MCP)
Satyam Computer Services Ltd. Tag: Loading (Running) EXE into GAC Tag: 92153
Display Member - Value Member
Hi everybody
In my TABLE2 I want to store as FK - ID values from TABLE 1 (see schema).
I get in my DataGrid (DataSource = TABLE 2) as DisplayMember name from TABLE
1 (whitch describes ID for easier use - see schema), whitch matching ID
(TABLE 1)
How can I do this ???
TABLE 1
id PK - int (ValueMemeber in DataGrid)
name - string (DisplayMemeber in DataGrid)
TABLE 2
id PK - int
id1_table1 FK - int
id2_table2 FK - int Tag: Loading (Running) EXE into GAC Tag: 92151
Button and Enter key
Hello,
A button can be clicked by using the mouse, ENTER key, or SPACEBAR if the
button has focus. Is there a way for me to make it so that hitting ENTER when
a button has focus does nothing? I don't want ENTER to ever cuase the
button's click event to be risen.
Thanks,
-Flack Tag: Loading (Running) EXE into GAC Tag: 92149
Disable drag & drop outside of control
Hi All,
I am working on a VB.NET app that has multiple windows. I am using
drag & drop to move items within a list on the same form, but I want to
disable drag & drop between the 2 windows. I thought I could disable
the drag & drop when the DragLeave event was fired, but alas, DragLeave
only uses System.EventArgs, so I can't set e.Effect to None.
Short of prefixing my dragged items with the window number and just
doing a check when entering another drop-able control, is there any way
I can disable the drop?
Thanks in advance!!! Tag: Loading (Running) EXE into GAC Tag: 92143
GDI+ stats with Performance Monitor
Is it possible to monitor GDI+ activity with the performance monitor?
Thanks Tag: Loading (Running) EXE into GAC Tag: 92142
How to draw text that will fill a panel(form, etc.)
Hi,
I would like to draw centered text that takes up the entire paintable
area of my form.
I know how to use a StringFormat to center the text both horizontally
and vertically.
What I don't know how to do is choose the correct height (and width?)
for my font.
When the form is resized the font size (and width?) will have to be
updated.
Thanks,
BT Tag: Loading (Running) EXE into GAC Tag: 92139
How to call GDI CreateBitmap function using C#
Hi,
I do have a Bitmap object in a C# application, i would like to create a
bitmap using the GDI function CreateBitmap which could return me a valid
HBITMAP (Dont want to use the GetHBitmap method which returns a 24bits bitmap
which will loose any Alpha informations like transparency).
The declaration for the function will probably look like this :
[DllImport("gdi32.dll")]
public static extern IntPtr CreateBitmap(int nWidth, int nHeight, uint
cPlanes, uint cBitsPerPel, short[] lpvBits);
But i have no clue how to provide the parameters CBitsPerPel and lpvBits,
and what they do correspond to in the .NET Bitmap object.
Any idea how i could call this function properly ?
Thx. Tag: Loading (Running) EXE into GAC Tag: 92136
ToolStripItem ordering.
I am dynamically creating toolstrips and was wondering if their is a way to
specify item ordering. The default seesm to be that Items are displayed in
the order they are added. What if I wanted to be able to insert an item
between existing items? Tag: Loading (Running) EXE into GAC Tag: 92135
common inheriting class for list controls not satisfactory
Hi,
I want a common class through which I can use the common functionality
provided by the combo box and listbox controls. To elaborate what I'm saying:
I wrote a function in which I use the following:
1 - BeginUpdate
2 - EndUpdate
3 - Items collection
4 - items.clear() method
above four are avilable in both the combobox as well as the listbox (also
listview and maybe some others). I pass a listbox to that function. Now I
want to use the same functionality for a combobox also, but cant do that. If
I take ListControl as a parameter, which is the base for combo and listbox,
it doesnt have a "items" collection neither the "*Update" methods. If I use
the ObjectCollections class, they are specific to the listbox and combo as
they r inner to both of them.
Is there any way I could do this. I dont have the options of
extending/inherting from these combo or list control and make my own stuff
and pass to this function.
Regards,
Abubakar. Tag: Loading (Running) EXE into GAC Tag: 92132
Combobox paint problem
Hi all,
I've got a windows app in development - one of the forms has a tab control
on it and one of the tabs has a combo box on it.
On the first entry to said tab the combo box displays correctly. Leave the
tab (to another tab) and return, the combo refuses to paint itself.
If you click where the drop button is supposed to be the drop down appears.
Any ideas & thanks ... Tag: Loading (Running) EXE into GAC Tag: 92131
Microsoft VSTO
Hello,
Can anyone suggest me any good links for learning to use Microsoft VSTO.
I need to embed my VB.NET Application into Excel using VSTO.
Regards,
Rohit Tag: Loading (Running) EXE into GAC Tag: 92125
DataGridView: show not all columns of DataSource
Hi,
I'm trying to use tha DataGridView of .NET 2. But it doesn't seem to have
something like a tablestyle, permitting you to show only some columns of the
DataSource andn ot all of them.
Does anybody knows how to do this? I want for exemple not that the ID of my
records are shown in the DataGridView etc.
Thanks a lot in advance,
Pieter Tag: Loading (Running) EXE into GAC Tag: 92124
shortcut and InputLanguage
the ShortCut work fine, you just put & charecter on text, and use Alt key
with letter.
but i have problam:
we have a form with English Input textbox, but the ShortCut is on another
InputLanguage.
in MSAccess the shortcut work with 2 Language, but in dotnet the shortcut
must be on the same
language as InputLanguage!
i try to find event, or windows msg, to trap the point befor DotNet search
after control with shortcut,
but it's not work.
please help! Tag: Loading (Running) EXE into GAC Tag: 92122
Main form sent to back when child is hidden
Hi,
I have a form A that shows and hides a form B.
B's owner is set to A. B is modeless so allowing interaction with
A in the background. I have a double-click event that selects an item
in B and hides it. Sometimes, the double click causes the main form to
be sent to the back of all apps currently running, causing great
confusion. You have to alt-tab to get it back.
I can't reproduce this bug on demand. Does anyone have any ideas on
this?
regards
avner Tag: Loading (Running) EXE into GAC Tag: 92119
Programmatically selecting a DropDownList item
I need to programmatically make a selection of a dropdownlist/combobox item,
which naturally should force the DropDownList_ValueChanged procedure to fire
because it detected that the user made a selection change in the
dropdownlist control. Please help. Tag: Loading (Running) EXE into GAC Tag: 92117
unable to display text in textbox
Hi,
I am using third party control. I wrote an eventhandler for capturing one
event, In the event handler i am assigning some text to a textbox, when i
debug it and keep break points i am able to see the text in the textbox, but
when i remove the breakpoints i could not see the text in the textbox, while
debugging i could see the message " Function evaluation disabled because a
previous function evaluation timed out. You must continue execution to
reenable function". Can any one help please.
Thank you Tag: Loading (Running) EXE into GAC Tag: 92114
XP Theme Not Working
I have a manifest file called app.exe.manifest and it works great on any
developers machine, but once we deploy the application (smart client) on the
web server and the users use the url to bring up the application it doesn't
have the xp themes any longer. Is the application using the web server to
figure out wether to use the theme? I thought the application got cached down
to the user and it would have used the users machine to figure out wether to
use the xp themes or not?
Any help would be appreciated. Tag: Loading (Running) EXE into GAC Tag: 92111
Asynchronous painting in control using BeginInvoke in Invalidate/Refresh
I have a control that paints an System.Drawing.Bitmap. Let's say that I fork
off 5 worker threads to do some image processing and I want to display each
image that the worker threads process in my control. So I will basically
have a bunch of threads throwing images to my control which is then
displaying them. The articles I've read seem to indicate that really only
the painting of the control needs to be handled in the main UI thread and
that everything else up to that point can be done in the worker thread. So I
overloaded the Invalidate method as follows:
Private Overloads Sub Invalidate()
If Me.InvokeRequired Then
Me.BeginInvoke(New MethodInvoker(AddressOf MyBase.Invalidate))
Else
MyBase.Invalidate()
End If
End Sub
Since I'm painting a System.Drawing.Bitmap, I also need to make sure that
only one thread (including the UI thread) accesses the bitmap at a time. For
this, I do a little SyncLock-ing as follows:
'Called to display a new image
Public Sub DisplayImage(ByVal vBitmap As System.Drawing.Bitmap)
SyncLock mBitmapSyncLock
If Not mCurrentDisplayImage Is Nothing Then
mCurrentDisplayImage.Dispose()
mCurrentDisplayImage = vBitmap
End SyncLock
Invalidate()
End Sub
'Paint the bitmap
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
SyncLock mBitmapSyncLock
'Painting goes on here
End SyncLock
End Sub
My question is: will this work? I've had problems in the past of my app.
vanishing on me and displaying errors such as "Failed to load resources from
Setup File" or something and I believe it was from violating some rule of
the updating the UI from a different thread. Does the above look thread
safe? Can I call the DisplayImage(...) method and be sure that everything is
being handled in the proper thread?
Thanks Tag: Loading (Running) EXE into GAC Tag: 92109
Combobox DropDownList control layout/format issues
Hi there,
I'm using VB.NET.
I have a Combobox DropDownList on the far right hand side of my windows
form (unfortunately I can't move it, it has to stay there). The
problem is that there are several items in the dropdown that are very
LONG, and you can't read everything in the space provided. I modified
the DropDownWidth property so that the words can fit, but because the
dropdown is on the right hand side, when I click on it, the dropdown
expands to the right off the screen! I can't even see the scroll bar
if there are several items. Is there a way to have the dropdown expand
upwards and to the left when I click on it? Unfortunately due to
design constraints I can't move the dropdown somewhere else!
I've tried changing the Anchor properties but those don't do anything.
Am I missing something?
Thanks!
ed Tag: Loading (Running) EXE into GAC Tag: 92104
Custom Collection Item Swap with ListBox DataSource problem
Hello!
I have a Custom Collection which is set as datasource to a ListBox. A Form
enables moving items up and down in the list. In the collection this is
implemented like this:
public void Swap(int oldIndex, int newIndex)
{
if (newIndex >= 0 && newIndex < List.Count && newIndex != oldIndex)
{
object tmp = List[newIndex];
List[newIndex] = List[oldIndex];
List[oldIndex] = tmp;
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemMoved,
newIndex, oldIndex));
}
}
What happens now is that the listbox automatically switches positions of the
items and selects the new index (as should). The problem is that when the
event SelectedIndexChanged for the ListBox is triggered (automatically), the
SelectedItem is still the old item! How is this possible? Does the ListBox
select a new index before refreshing its datasource? ...
/AZ Tag: Loading (Running) EXE into GAC Tag: 92103
Determining the resolution of a video file
I am displaying video in my own form using the AxWMPLib.AxWindowsMediaPlayer
class. I need to know the resolution of the video file so that I can set the
size of the window hosting the control.
Is there a way of determining this? Tag: Loading (Running) EXE into GAC Tag: 92100
WinForms font issue
I'm relativley new to .NET but one thing that has instantly hit me is that
text doesn't seem to draw correctly in controls like the label and frame.
The issue is that labels draw with a wider horizontal font-spacing than they
should.
It's a small problem but it totally screws trying to have a uniform look &
feel. For example, having a listview and label on a WinForm the label will
look different than the information in the listview.
This issue is particularly noticable with the Tahoma font.
Is it fixable?
Em Tag: Loading (Running) EXE into GAC Tag: 92094
App stops Windows from closing
Hi
I have an odd problem. While my .net form app is running, although idle, I
can't shut down Windows. Nothing happens when trying. That is, all other
apps are closed but not my own app. Only when closing my app manually
Windows resumes closing itself and the computer. What can be the reason for
this? (Theres no closing dialogs or similair and no freeze)
/Andreas Z Tag: Loading (Running) EXE into GAC Tag: 92092
Drag n Drop URL from IE problem
Hi
I have a form app which stores URL:s dragged to it from IE. The problem I
have occurs when a URL has been dragged and dropped onto the form and when
the user either moves the cursor back over the browser window (without any
clicking) or when clicking in form after the drop operation. When moving
cursor back to the browser, the browser emediately reloads the URL as if the
drag operation wasn't allready completed and now followed the cursor back to
the browser window again. Secondly, when the user has dropped the URL onto
the app form and then also clicks in the form, the drop function is
activated once more! Do I explicitly have to close or finish the dragdrop
process once the data has been dropped as expected the first time?
Thanks for any suggestions!
/Andreas Z Tag: Loading (Running) EXE into GAC Tag: 92091
How to keep focus in one form when clicking on another?
Hi,
Iâ??m writing a touch-screen application in C#. One form has the buttons that
make the on screen keyboard, and the others have all the input/edit controls.
How can I avoid focus to move to the keyboard-form when a button is pressed?
I know how to set focus manually, but I would prefer the framework to handle
it.
-Robert Furu Tag: Loading (Running) EXE into GAC Tag: 92089
MultiTable in DataGrid
I want to show the relation between two tables, for example BookTitles and
Authors, in a DataGrid. I want show Authors and when I click one, I want all
the author's books appears under him in the same datagrid.
Any code snippets ???
Many thanks
NQ Tag: Loading (Running) EXE into GAC Tag: 92086
When a print job is finished ???
I print a document word from a VB.net application in this way:
Dim W As New Word.Application, D As New Word.Document
D = W.Documents.Open(FiledocumentPath, ReadOnly:=True): D.PrintOut
I need to close my word application only when the print job is finished. If
I close it before, the word document is not printed; If I don't close the
word application It is open all the time and if I print another word document
another word session is opened...
Is there a way to know when the document is fully printed ???
Many thanks
NQ Tag: Loading (Running) EXE into GAC Tag: 92085
Hi,
Could anybody provide good reason for me to load my windows forms exe into
GAC and then use it as primary application location?
Hrm... never heard anybody do this. However, you might want to try ngen'ing
it to see if you get a speed improvement.
"Leonid" <shprekher@bessemer.com> wrote in message
news:uk8iXAhuFHA.3596@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> Could anybody provide good reason for me to load my windows forms exe into
> GAC and then use it as primary application location?
>
> Thanks,
> Leonid
>
>
Speed improvements? I don't think this is going to be faster.
What about security and versioning?
> Hrm... never heard anybody do this. However, you might want to try
ngen'ing
> it to see if you get a speed improvement.
>
> "Leonid" <shprekher@bessemer.com> wrote in message
> news:uk8iXAhuFHA.3596@TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > Could anybody provide good reason for me to load my windows forms exe
into
> > GAC and then use it as primary application location?
> >
> > Thanks,
> > Leonid