ComboBox DataBinding examples ?
This is not a question. Just an observation I need to share.
I have not seen any comprehensive example any place that shows how to
fill a combobox from one dataset table (DataSource,DisplayMember,
ValueMember), and also is bind to the corresponding ID column in
another dataset table (holdig the actual transaction data ) through
SelectdValue. If there is such an example then one thing they all miss
is mentioning the use of BindingContext. I had been banging my head
against this for long . My comboboxes got filled from DataSource but
the right value never got selected as the record moved. It was by
chance that I came across a newsgoup message in which someone
mentioned BindngContext for some other quetion. then I used
"MyComboBox.BindingContext = this.BindingContext ;" and it worked fine
I am particulary referring to the example at :
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsData.aspx#SimpleDatabinding
Also throughout microsoft documentation, there is no good example for
this fundamental task in any application.
If anybody knows any good links then let me know. thanks
Aamir Tag: Event Handling oddities Tag: 58708
Access Property value in PropertyGrid
Hi all,
I am writing a UITypeEditor for a custom class and am wanting to populate
it's standard values with different sets depending on the value of another
property.
I am thinking that in my TypeConverter I need to access the propertygrid in
order to set these values. Is this possible and/or is there a better
solution to this problem.
Thanks,
Cole Tag: Event Handling oddities Tag: 58706
Windows.Forms and GC.Collect
I'm working with a database server that has many many
objects allocated. 170 megs worth. I have several
hundred tables imported which are represented in memory by
a variety of objects. It's a tribute to the generational
garbage collector that it runs so well normally.
The problem I am having is that the internal parts of
Windows.Forms that work with the Win32 handles are calling
GC.Collect several times when I load up a form, as
described nicely by this page:
http://weblogs.asp.net/Cgero/Story/2742.aspx
GC.Collect runs a full third generation GC on every single
object. This happens five times on one typical form. The
result is that the form takes 12 seconds to be shown,
which is obviously unacceptable for something that should
be nearly instant.
The database can be run as a seperate process but we've
designed our database "IDE" to run it inprocess and that
is what we have built our development model around.
Are there any workarounds available? And does this
questionable code need to be reworked and fixed in future
versions of the framework?
Is it acceptable to have the framework calling GC.Collect
like this? The least that can be done is pass in a
generation retreived from GC.GetGeneration on the object
tring to be removed.
Bryan Livingston
PS. I'm not sure if my email address has been added as an
alias, but we do have an MSDN subscription here at Alphora. Tag: Event Handling oddities Tag: 58705
listing all the ports
Hello All,
I am wanting to list all the port like when you go to
printers--> right click properties--> then pick the Port
tab. And you will see a list of available ports. How do I
list these and any info related to each port? I am writing
in C# , so I would greatly appreciate a small example in
C#.
Thank You in Advance for Your Help,
Ken Tag: Event Handling oddities Tag: 58701
Setting the designer on a user control in VB.NET
I am unable to set the designer on a user control using the Designer
attribute on the UserControl class. I am able to get it to work in C# but
the same attribute is not recognized in VB. The code I'm using in C# is as
follows.
[Designer("System.Windows.Forms.Design.ParentControlDesigner,System.Design",
typeof(System.ComponentModel.Design.IDesigner))]
public class MyControl : System.Windows.Forms.UserControl
This allows the user control to act as a container in the IDE allowing other
controls to be nested within it. Using similar code in VB results in the
IDE reporting the designer attribute is not recognized. Am I missing a
reference or is this just not possible in VB?
Thanks! Tag: Event Handling oddities Tag: 58700
Question about config files
Hi,
I have two applications and I would like them to use the
same config file to get their app settings.
How do I do this?
Thanks,
James Tag: Event Handling oddities Tag: 58688
datarelations with textboxes and comboboxes
Is there a sample out there that uses datarelations with
textboxes for both the parent and children? That
updates, adds, and deletes rows from a database in SQL
server 2000? That uses VB.NET 2003? That scrolls
through the children (can this even be done in a
winform?)?
I know about the basics of datarelations, updating,
adding, and deleting. I guess I am not really sure how
that all works with just using text and combo boxes. All
samples have a datagrid for children that I have found.
Are there any out there that just uses textboxes?
Let me know if you know of a sample someplace, a book
that would get me started, a website that is worth a
look, if someone is alive out there, or if you have some
insight of how you would do it.
Been working on this one form for awhile now. I just
want to get rid of it.
TIA,
Charles Tag: Event Handling oddities Tag: 58686
Creating an Instance of a Panel
Hi,
This may be a stupid question, but I can't get it to work (if possible at
all)
How can I load an instance of a panel that exists in one form, into another
form?
Basically, I'm trying to figure out how I can reuse a form, if all that
needs to change are a few panels.
Should I just load a different form every time?
Thanks,
Philip Tepedino.
Siemens Westinghouse Generation Services
ftepedino@swgs.net Tag: Event Handling oddities Tag: 58677
How to make a context menu popup at specific position from another event such as btn clk.
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01C38F1C.9F13B130
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm trying to create my own main menu bar so I'll have greater control =
of how it looks and works. So I was going to have either a button or an =
image act as the File menu button and when the user clicks on it, I =
wanted to force a context menu to pop open properly aligned at the =
bottom left corner of the of the File button. Problem is that context =
menus seem to want to be associated with a specific control. From code, =
how can I tell a popup menu to show at a specific point?
Thanks.
--=20
moondaddy@nospam.com
------=_NextPart_000_000A_01C38F1C.9F13B130
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm trying to create my own main menu =
bar so I'll=20
have greater control of how it looks and works. So I was going to =
have=20
either a button or an image act as the File menu button and when the =
user clicks=20
on it, I wanted to force a context menu to pop open properly aligned at =
the=20
bottom left corner of the of the File button. Problem is that =
context=20
menus seem to want to be associated with a specific control. From =
code,=20
how can I tell a popup menu to show at a specific point?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- <BR><A=20
href=3D"mailto:moondaddy@nospam.com">moondaddy@nospam.com</A></FONT></DIV=
></BODY></HTML>
------=_NextPart_000_000A_01C38F1C.9F13B130-- Tag: Event Handling oddities Tag: 58674
ListView Add() INCREDIBLY SLOW?
I'm using a for loop to add about 5600 items to a list view. It's taking
about 5 minutes for the loop to complete. Is this normal? Would AddRange
work quicker? What's the quickest way to add items?
Thanks,
Steve Tag: Event Handling oddities Tag: 58671
Licensing in Dot Net
I want to implement Licensing in .Net. The program will
run only if valid license is there. I want to do this by
writing some values in Registry, and program will check
those values whenever the program runs and will run only
if valid license is there. Tag: Event Handling oddities Tag: 58662
datareader - how many records.
Hello,
As you can see from the attached code I have a
datareader called Myreader. I wish to find out how many
records are in the datareader so that I can set the index
of the customers array precisely.
Dim customers(100) As Customer
i = 0
Do While (Myreader.Read()) And i <= 100
customers(i) = New Customer(Myreader
("customerkey").ToString, Myreader("companyname").ToString)
i = i + 1
Loop
Yours hopefully
Robert Tag: Event Handling oddities Tag: 58661
MDI within MDI?
Hi All,
Has anyone tried putting MDI within MDI:
MDI Parent[IsMDIContainer] ->
MDI Child [IsMDIContainer] ->
MDI Child)?
Just asking because I won't waste time protyping this if someone says they
already did and it's "WinForms incompatible".
SteveH Tag: Event Handling oddities Tag: 58659
Smart Client Web AutoDeployment, Remoting and Config Files
Back to this notorious topic being left unanswered despite the many
postings.
I have a WinForm client application which talks via remoting to another
assembly on another machine. The client configures itself using
RemotingConfiguration.Configure("<exename.exe>.config");
Remoting works fine before the autodeploy comes. The application fails with
the following exception:
---------------------------
System.Runtime.Remoting.RemotingException: .Config file
Prototype.UI.exe.config can not be read successfully due to exception
System.IO.FileNotFoundException: The system cannot find the file specified.
-----------------------------
The server virtual folder has a web.config file with the required hack:
<httpHandlers>
<remove verb="*" path="*.config" />
<add verb="*" path="web.config"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers>
I verified that the config file is being downloaded by doing a trace between
the client and server.
My personal explanation of this phenomena is that
RemotingConfiguration.Configure looks for a physical file in the same folder
where the executable is, while the config file is never saved using
autodeploy.
I would like at this point someone at Microsoft to confirm officially that
remoting doesn't work with web autodeployment or does it? Tag: Event Handling oddities Tag: 58654
Reading multilanguge resource by GetManifestResourceStream
I have to resources files (text resources):
texts.resx and texts.uk.resx
I want to enumerate resources of this, i am doing this in such way:
Stream resStream = _asmbl.GetManifestResourceStream("namespace.texts.resources");
if (resStream!=null)
{
System.Resources.ResourceReader resReader = new
System.Resources.ResourceReader(resStream);
IDictionaryEnumerator dictEnum = resReader.GetEnumerator();
while (dictEnum.MoveNext())
{
....
i get resources goot, but only default resources, i cannot read
localizated file. How to make in this code enumerate resources from
texts.uk.resx? Tag: Event Handling oddities Tag: 58653
How to get name of image loaded in a picturebox
Hi All,
Simple question.
If I have picturebox loaded with an image how do I query the name of
the image held in the picturebox.image property?
Thanks, Tag: Event Handling oddities Tag: 58652
Windows Form Skins
Are there any skinning controls that I can use to make my vb.net windows
application look cool like media player?
Please help!
Elango Tag: Event Handling oddities Tag: 58650
creating windows user controls in Visual C++ .net
Hi,
I wants to create a windows user control in Visual
C++ .Net. How to do that?
I can easily do in Visual C#, because there is a project
templeate "Windows Control Library", but there is no such
templte for Visual C++ .Net projects.
Please explain me in detail.
Please suggest me correct news group if this is not
appropriate group for Visual C++.Net .
Thanks in advanace.
Nagaraju Tag: Event Handling oddities Tag: 58643
Error trying to run deployed windows application
Hi all,
I've developed a .NET Windows application which was
originally made in VB6 and migrated using the VS7
migration wizard.
After resolving all upgrade issues my application worked
fine on my development pc.
The application connects to an Oracle database
(unfortunatelly) and uses some VB6 controls such as
MSFlexGrid to show data.
Although I've created a deployment project and run it on
my target pc the application won't run throwing an error
like ProcessID=number and TrheadID=number.
My target pc is able to connect to the database through an
Oracle DB SQLPlus client (using the correct TNS) and have
also installed MDAC 2.7 SP1. The ADODB.DLL is placed
through the installer.
All needed dlls are supposed to have been installed by the
application installer but the application still won't run.
Is there any way to find out what is wrong?
Any help will be great.
Thanks and sorry for the long post.
Manos Tag: Event Handling oddities Tag: 58642
.net Windows controls in a VB6 program
Is is possible to run a .net Windoews control in a VB6 application?
Andrew Tag: Event Handling oddities Tag: 58637
Showing invisible modal form
Hi all,
in my application I'm showing a modal dialog indicating
the progress of background process. I would like the
progress indicator to appear not immediately after the
background process starts, but some seconds later. The
purpose is to avoid window winking in case if the process
takes very little time. So, my question is:
how to show a modal but invisible form?
Currently I'm using the Form.Opacity property to achieve
this. After background process starts, I do ShowDialog
with Opacity = 0, and set Opacity = 1 after some time if
the process is still executing. But I wonder about
portability of this approach, and I'd prefer more
reliable way.
Thanks,
Dmitry Tag: Event Handling oddities Tag: 58636
Constructting and executing code at run time
Hello all
I am currently architecting an application that will
centralize launching of a set of internal applications
from a single point of entry.
One of the aspect that needs to be considered is that we
want to be able to add additional internal applications to
this central access point application without change the
code for this central access point application. This is
some what like adding plugins to internet explorer (how is
this done btw?).
I am in the early stage of designing this. But one of the
early solutions to this is to have a configurable XML file
that is read by this app each time it starts. This XML
file will contain information about all DLLs that are
plugged into the application. So adding a plugin would
simply mean adding entries to this XML file. To achieve
this, the internal applications plugged into this central
app will be instantiated by constructing calling codes
from the XML data.
So my questions are
1. Is there a way to execute code that are constructed
programmatically at run time?
2. Any suggestions of how i may build the application
described above? Tell me if you need more information in
order to give comments on this.
Cheers
James Tag: Event Handling oddities Tag: 58628
The Form sometimes will lose the focus
Everybody:
When I Switch the Input to input the Chinese,the Form sometimes will lose
the focus,the application has no response. Tag: Event Handling oddities Tag: 58622
updating child table
I have a parent child relation set up in both .net and in
sql. When I run the data adaptor to update added records
(DataViewRowState.Added) in the parent table, the child
records are automatically set to modified. Then when I
want to run the data adaptor to insert the child records,
because they have been chanbged from added to modified,
they are not inserted.
This makes the pattern--update parent, then update child--
impossible to carry out.
This seems to be a bug in the data adapter. The one
posting that admits this: 320301 does not work for me.
I need the answer in C# please. Tag: Event Handling oddities Tag: 58621
Help with some information on imaging subclass
Hello i'm developing a software that includes images, i see that VB.NET has
the option to save the image in diferent formats, but i need to know what
type of compression or porcentaje of quality is applied in the jpeg format,
i have looked but no information was able to find.
any help would be appreciated, in advance thanks
library tree as follows
System.Drawing.Imaging.ImageFormat.Jpeg Tag: Event Handling oddities Tag: 58620
SystemColors problem !
Hi,
I want to use the SystemColors class to retrieve my current system colors.
But I have a problem with the InactiveCaption propertie, in Display
Properties of Windows this propertie has two colors. The
SystemColors.InactiveCaption propertie returns only the firs color, how can
I obtain the second color ??? Tag: Event Handling oddities Tag: 58619
Draw a Line on a windows form
Ok this is ridiculous but...how the heck do you draw a line on a windows
form in design mode? There used to be a toolbar for VB forms but I cannot
find it in VS.NET
thanks,
eRic Tag: Event Handling oddities Tag: 58605
Error in Calling..the same form again
Hello ,
I am developing an application using objects where my
object gets updated from a second form. when I update the
object the first time it works fine but when I reload it
using frm.showdialog it gives me an error
system.argument..error and invalid Parameter Used. I am
unable to find out the reason. also in the form
constructor new i am overloading it and passing my object.
any suggestions Tag: Event Handling oddities Tag: 58593
Problem Disposing file locks in a PictureBox
My problem concerns the fact that PictureBoxes appear to retain a lock on
the file supplying the image, and I cannot work out how to release this lock
deterministically (within the Dispose method).
I have a UserControl which contains a PictureBox. On my form I have a Panel
containing a collection of these UserControls. Each has it's image loaded
using Image.FromFile(). My program needs to delete the illustrated files at
certain times, but each File.Delete() attempt causes an exception reporting
File in Use. I have proved conclusively that it is the UI PictureBox control
that is causing this, even though I clear the UI down before I attempt the
Delete.
I've written a lot of what you might assume would be unnecessary Dispose()
code to try and clean up these locks. Can anyone shed light on how this
should be done, PLEASE???
In my UserControl, I have (thus far!):
protected override void Dispose( bool disposing )
{
if ( disposing )
{
// attempt to destroy the PictureBox and all its resources
Controls.Remove(picThumb) ;
picThumb.Image = null ;
picThumb.Click -= new System.EventHandler(this.picThumb_Click);
picThumb.MouseEnter -= new
System.EventHandler(this.picThumb_MouseEnter);
picThumb.Dispose();
picThumb = null;
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
And on my Form, I run this code:
while (panel1.Controls.Count > 0)
{
Control ctl = panel1.Controls[0] ;
panel1.Controls.RemoveAt(0) ;
ctl.Dispose();
}
panel1.Controls.Clear() ;
Application.DoEvents() ;
// now attempt to Delete files...but it will fail.
Brian Smith Tag: Event Handling oddities Tag: 58587
Cancellable events
I dont like the concept of cancellable events, why cant we have an event
that we can catch before the event we must cancel?
Take the following example
WM_SYSCOMMAND and SC_CLOSE for the system menu close item or close button,
in WinForms you must cancel the Closing event, isnt that too late? Sure it
works but it seems messy compared to actually catching an event that the
item is selected.
Are these a good idea or just lazy or unthought out designing? Tag: Event Handling oddities Tag: 58581
How to: Launch application AND open the "triggering" file
Hi, I need some help. Hopefully this is trivial!
I have created a special file type for my application. I can easily
associate the app with the file type manually and I have even seen som code
to do this as well. (MSDN - 185453)
However, once the app is launched after double-clicking on the file,
how can I identify which file was selected, i.e. triggered the launch.
Pls point me to the right direction for search!
Thanks,
Bob Tag: Event Handling oddities Tag: 58577
How To: Specify the ORDER of attributes written to an XML file???
I'm using XmlSerializer to write an simple class to an XML file. I expected
that the member data would be written out in the order it appeared in the
class, but it doesn't. Does anyone know what determines the order when a
class is deserialized? Any way to control the order?
Thanks,
Steve Tag: Event Handling oddities Tag: 58576
ANN: DataGridNetPlus
New Windows.Forms.Datagrid control with VB.NET source code just only
US$ 79.00.
DataGridNetPlus is the datagrid that inherited from Microsoft .NET
Framework System.Windows.Forms.DataGrid with the following additional
feature:
1. Five more DataGridColumnStyle i.e.
- TextboxButtonColumn
- ComboBoxColumn
- DateTimePickerColumn
- LinkLabelColumn
- ImageColumn
2. Can set Enter Key to next column
3. Can set Vertical scrollbar
You can integrate DataGridNetPlus to IDE as adding any control to
Toolbox.
Please visit us as www.datagridnetplus.com
Don't spend your valuable time coding and testing on creating
DataGridColumnStyle.
Cheer.
Pairat Tag: Event Handling oddities Tag: 58574
Strange / Weird Combo Troubles
I have two forms one with one combo (frmSearch), and another with three
combos (frmPart).
Each combo is filled using a class object which essentially opens a
datatable based on an SQL query, and sets the display / valuemembers.
frmSearch has one unbound combo.
frmPart has three combo's which are bound to a datatable, using the form's
currency manager.
Both forms have a debugging button which displays the row count of each
combo.
When I open frmSearch, The combo is filled, and the first entry is visible.
Clicking the debugging button tell me there are 11 rows in the combo.
Then, when I click on the title bar (the blue bit at the top) and drag the
form, the the combo clears, and cliking the debugging button tell mw the
combo is now empty!!!!!!
When I open frmPart (the 3 bound combos), randomly, some of the combos are
filled, sometimes all, sometimes, none, sometimes two of them are filled,
and the debugging button reports the contents in line with each combo's
state. On one occasion I just moved the mouse and all three combo's cleared
and had no rows in them.
Has anybody else had experience of this??
I am baffled?
Alex Tag: Event Handling oddities Tag: 58572
Last line for Exception
Is there any way to do the same as Resume when you are in
the debugger in an exception handler? I want to go back
to the exact line that caused the exception. How do i do
this? Currently i disable the exception handler and add
the on error goto and then perform a resume but that seems
really dumb Tag: Event Handling oddities Tag: 58571
Re: hide column(s) in windows datagrid
Thanx for the answers.
I've done all the things you tell me to do.
The problem here is that tha datagrid doesn't respect the GrdColumnStyle
settings, let's say that my query returns 10 columns, and I just set 5
columns in the datagrid because I only want to show 5, and set the first
column width to 0. Well, not only the first column is shown, but I also get
all the columns from the query in the datagrid. It's like the tablestyle
setting is being bypassed.
I'm trying to find the way to get closer (without getting hurt in the
process) to the Datagrid Web Control, wich is much easier to use and set.
thanx for the answers!
Ignacio
"Hector Correa" <hcorrea@RemoveThis_visionds.com> escribió en el mensaje
news:077501c38e13$b7bcc370$a301280a@phx.gbl...
> Hola Ignacio,
>
> As Chris mentioned, you need to use TableStyles to do
> what you want to do. And indeed, it is more complicated
> than it should.
>
> Here is an example of a small class that I created to
> save the properties of a grid to an XML file so that next
> time the user launches the form the grid properties (e.g.
> column width) are preserved:
>
> http://www.gotdotnet.com/Community/UserSamples/Details.asp
> x?SampleGuid=c70c9240-d404-4f5c-b2fc-45475ef1eeb0
>
>
>
> >-----Original Message-----
> >Hey group!
> >I have worked with ASP.NET Webforms for quite a long
> time, and about a month
> >ago I started working with VB.NET Windows Forms.
> >And I found the Datagrid control to be a bit different
> from the Webforms
> >control.
> >Above all because I had to design Table And Column
> Styles, and I Don't know
> >how to make a Column invisible.
> >(following other option that's not width = 0).
> >I believe that if I set a MappingName for a column, this
> sets a relation
> >between the column and the Datatable Column Name.
> >But what If I want to hide the ID Column? and Can I just
> show the fields I
> >want instead of receiving all the columns from the
> Datasource? (Dataset in
> >this case)
> >
> >I hope my english is clear enough.
> >thanx in advance
> >Ignacio. Tag: Event Handling oddities Tag: 58570
Keep the DataGrid from scrolling when clicking on last visible row.
I need to figure out a way to keep my DataGrid from scrolling when I
click on the last visible row.
What's happening is when I click on row 5, which is the last visible
row, the datagrid scrolls so that row 6 is now the last visible row.
I'm trying to handle the mouse down/up events and catching double
clicks and this row shift is screwing things up.
Is it possible to keep the datagrid from moving around like that, when
you click on a row? I've already inherited the grid for other
reasons, so that's not a problem for me.
Thanks... Tag: Event Handling oddities Tag: 58569
TextBox.TextAlign
Hello NG
Task: Left align the contents of a textbox as long as it
has the focus; while it's not focused, the contents should
be right aligned.
Tried: Set the TextAlign property to
HorizontalAlignment.Left or Right in event procedures.
Result:
- GotFocus/LostFocus: On re-entering the textbox an error
occurs: "Object reference not set to an instance of an
object". The GotFocus event is fired more than one time.
- Enter/Leave: The textbox cannot be left by pressing Tab.
- GotFocus/Leave: same as Enter/Leave
- Enter/LostFocus: On re-entering the textbox by clicking
on it it's contents are deleted, the alignment is not
changed to left.
This behaviour (I think it's a bug) is the same in VB.NET
and C#. In VB6 it works fine.
Anybody got a hint?
PS: This feature is needed for a numeric control derived
from TextBox. The behaviour is as described with the
TextBox class itself as well! Tag: Event Handling oddities Tag: 58567