Datagrid TableStyle
I have two grids, two datatables, and a relation object set up in a
VB.net windows form. It is in a master detail set up so that the first
grid is mapped to the first table via the datasource property. The
second grid is mapped to the first table also but the datamemeber is
set to the relation object. So that when a row in the first grid is
clicked the second grid automatically displays the data associated with
that the selected record. This is great and all works well. The issue I
am having is that when I build the table style for the second grid it
never gets used. I am setting the mapping name of the tablestyle to try
and point it to the appropriate table in the grid, only no matter what
I map it to, and I have tried all three elements datatable1,
datatable2, and relation object, it doesn't seem to format the grid. I
even read somewhere to try datatable.relation and that did not work
either. Any ideas? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88317
Parent-Child Relations and Strange ForeignKey problem
Here's the deal (simplified):
I have a Typed dataset with 2 tables Parent (ID, ParentName) and Child (ID,
ParentID, ChildName). ParentID in Child is an FK (ParentChildFK) to the
Parent table and is defined with cascase updating and deleting. The ID fields
are defined as autoincrement with a step of -1 and a seed of -1.
On a Winodws Form, I have 2 datagrids dgMaster and dgDetail. dgMaster is
bound to the Parent table and dgDetail is bound to the Parent table and the
ParentChildFK datamember.
Adding/Updating rows in the grids works great as long as things are done in
a certain order. If you:
1. Add a new row to the parent.
2. Add any child rows
3. Save.
it works just fine. The new child rows have the proper new ID's that were
returned from the database during the data inserts.
However, if you:
1. Add a parent record
2. Save
3. Add a child row
you receive an error from the datagrid saying that the ForeignKeyConstraint
was violated because the value, e.g. -1, does not exist in the parent table.
The parent row now has a positive, actual ID, but the child grid or currecncy
manager didn't seem to get the message that it should be using the new ID for
any new rows.
Anyone have any ideas on how to resolve this?
Thanks Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88308
[C# .NET] blocking refreshing application's view
Hello,
I am developing an application written in C# .NET.
E.g., there is a button when which I click on, "visible"
of a few labels, textboxes are set to false, and "visible"
of a few others are set to true. During this short
operation, I can see components which are dissapearing
and appearing flickering. I would like to avoid flickering.
Is it possible to stop refreshing view of application,
then hide and show contols I want, and finally refresh
view? If so, how to do this?
Maybe, there is any better method to achieve my purpose?
Robot Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88305
Deriving from WebBrowserSite
I am trying to use the .NET 2.0 Beta 2 WebBrowser control and customize
the IDocHostUIHandler as MSDN states:
"...implement classes that inherit from the
System.Windows.Forms.WebBrowser and
System.Windows.Forms.WebBrowser.WebBrowserSite classes.
The unmanaged WebBrowser ActiveX control uses the protected
System.Windows.Forms.WebBrowser.CreateWebBrowserSiteBase method
to retrieve extensibility interfaces implemented by the
System.Windows.Forms.WebBrowser.WebBrowserSite class. Override the
System.Windows.Forms.WebBrowser.CreateWebBrowserSiteBase method to
return an instance of your own class that inherits from the
System.Windows.Forms.WebBrowser.WebBrowserSite class. The
System.Windows.Forms.WebBrowser.WebBrowserSite class provides a
default implementations of the IDocHostUIHandler OLE interface.
You can provide your own implementation of this interface or implement
any other WebBrowser ActiveX control interface in order to customize
the behavior of the control. ...
Note If you provide your own implementation for any IDocHostUIHandler
members,
you must implement all the members of that interface."
Here are snippets of the relevant code:
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("bd3f23c0-d43e-11cf-893b-00aa00bdce1a")]
public interface IDocHostUIHandler
{
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int EnableModeless([In, MarshalAs(UnmanagedType.Bool)] bool fEnable);
.
.
.
}
public class ExtendedWebBrowser : WebBrowser
{
protected class ExtendedWebBrowserSite : WebBrowser.WebBrowserSite,
IDocHostUIHandler
{
public ExtendedWebBrowserSite(WebBrowser host) : base(host)
{
}
int IDocHostUIHandler.EnableModeless(bool fEnable)
{
return -2147467263;
}
.
.
.
}
protected override WebBrowserSiteBase CreateWebBrowserSiteBase()
{
return new ExtendedWebBrowserSite(this);
}
.
.
.
}
The problem is that the ExtendedWebBrowserSite IDocHostUIHandler interface
methods are never called. When I tried switching to the IDocHostUIHandler2
interface, the one method that IDocHostUIHandler2 adds was called, but none
of the IDocHostUIHandler methods were. I assume this is because
WebBrowser.WebBrowserSite
exposes the IDocHostUIHandler interface. So, how do you override the
IDocHostUIHandler COM interface exposed by the base class? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88304
Referencing a control using code
I have 24 text boxes on a form called C1, C2, C3 ........
I want to do the following
For J As Integer = 1 To 24
Me.Controls("C" + J.ToString).Text = J.ToString
Next
This code is wrong of course as Controls is expecting an integer to use as
an index.
How do I make it work?
many thanks
Rod Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88297
User resizing of panels
Is it possible to set up a panel so that the User can resize it?
The application has several small panels which contain controls. The User
can reposition the panels where ever required but would also like to resize
them.
I am experimenting with VB.NET 2005 as it look to be much better than 2003.
--
JamesT Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88295
Browse Directory on Button click and reflect in text box the path
Hi
I just wanted to Know when i click the button i need to browse the directory
and the selected file path should be reflected back in the text box
may i please know :-(
--
Thanks and Regards
Madhavi Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88291
OLE in VB.Net Forms
Hi
how can i have a copy of microsoft word on a vb.Net form.
i have done it very simply in VB6 using OLE: microsoft word document.
but in VB.Net i don't know the way.
any helps are welcomed. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88289
updating database schema on client machine during upgrade/install
We have a smart client application with an embedded MS Access database.
As we put out auto-updates for the application, at some point we also need
to update the Access database schema that's on the client.
This would involve backing up the user's existing data, installing the new
database schema and then copying user's data back into the new schema.
Can anyone recommend best ways to do this? Either writing our own code or
possibly looking at 3rd party tools who may provide this functionality.
Thank you! Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88285
Bug in MeasureString ?
Hi,
I noticed a little problem with the Graphics.MeasureString-Function:
I have a Textline, which contains Tabs. I use a StringFormat-Object, which
represents the TabStops. The DrawString-Method calculates the Tabs in the
text correctly. But MeasureString ignores them. I'm using the function as
following:
Dim w As Single = g.MeasureString(MyText, Me.Font, New PointF(x, y),
MyStringFormat).Width
x,y contains exactly the Drawing-Position of MyText (otherwise I would see
this in DrawString). And MyStringFormat stands for an GenericTypographic
-Object, which I'm using in the whole project for all Drawing-Operations.
It's extended with the Tabstopps.
Any suggestions?
Peter Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88279
win32 help! (or COM?)
I have downloaded this superb HTML Edit Control based on MSHTML
http://www.windowsforms.net/ControlGallery/ControlDetail.aspx?Control=290&tabindex=0
And it's also really big.....
Anyway, I would like to extend it with a very simple feature: typing
completion.
I need to know when the user type something and at which position of the
cursor (so I could show a popup listbox below).
Any clues/tips on how o do that?.....!!? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88276
HtmlEditor
I found this super cool sample!
http://www.windowsforms.net/ControlGallery/ControlDetail.aspx?Control=290&tabindex=0
I have yet to explore if I could do whatever I want. But seems much more
promising that the RichTextBox!!... Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88275
How to get multiple selections to open in one window?
Procedure:
1. Open a folder.
2. Highlight a bunch of .avi files.
3. Press enter.
What I want to happen is for my Windows Forms app to load all of the files
in the same process, but each file is instead opened individually by
seperate processes. How can I get my desired behavior? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88273
way to automatically Debug.Writeline every function/event thru reflection?
I have hundreds of events/functions in my windows app. now they look
like this
private void muHowlNow_Click(object sender, EventArgs e)
{
Debug.WriteLine("HowlNow was clicked");
this.Label1.Text = "wow";
//do some stuff
}
I am tired of having to put Debug.WriteLine("HowlNow was clicked");
every time. Is there a way (through reflection or some other magic) to
have it Debug.Writeline the function name automatically?
This will make life easier, and also when I obfuscate my code later it
will make it more difficult for a cracker to understand. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88268
way to "markup" label.Text ?
I am looking for a way to apply formatting like colors, bold etc to a
label.Text. Is there a way to do it? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88267
RichTextBox: Selection problem...
I have a few problem with selection (on Rtf text):
- 1. I have menu doing things (for example setting all to bold), so I
memorize the current selection with SelectiionStart & SelectionLength,
SelectAll(),apply my style, then reset the selection with the original
values of SelectionStart & Lenght.
However it's not the same text whihc is selected?!! (it's usually more..).
How could I fix that?
- 2. When I change selection (like with SelectAll()) The RichTextBox scroll
to the end. very annoying for the user to see its text moving for no reason
(because I selectAll() just for the sake of setting the style, then I revert
the selection, the user don't see that)! Any way to work around that? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88265
Power of System.Reflection.Assembly
I need to know if I can to list the objects of a form with the namespace
system.reflection.asembly.
For example, I need list all the buttons of the form.
Thanks for help. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88261
Scrollable controls questions
I've a control that inherit from Scrollabe control, and does custom
painting to draw itself.
However, I can't find out how to make it display the scrollbars when I
need them. I set AutoScroll to true, but it doesn't seem to help.
Another question, when I host a text box on the control, and click on
it, and then click on the control, the focus is still on the textbox,
even though I used Seleectable style and I call Focus() and Select() on
the mouse down event. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88260
RichTextBox question
Hi Folks!
I just begin playing with the RichTextBox, mhh... certainly a vast topic.
Anyway I want to prevent the text of being edited.
There is no Editable property. I try set the Enabled property but then the
text don't even scrol (not too mention I want to use URL).
How do I do that? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88257
how to pass array arguments between webforms
(Type your message here)
Can anyone clear my doubt of how to pass string arrays from one web form to another in asp.net.plzzz......i went thru many tutorials but cudnt find.
--------------------------------
From: Musheera Rehnath
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>QFckiRFaCUaWSUUqvLX3hA==</Id> Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88256
PropertyGrid does it automatically handle ContextMenu?
Can the PropertyGrid Control automatically handle the ContextMenu or should
I provide one?
When I right click on the control (at runtime) it does nothing.
Best Regards,
Alejandro Lapeyre Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88254
Win32Execption: The operation completed successfuly
Hello developers.
This is not my day.
I working with a C# WinForms application, I have about 200 hundred WinForms,
they are most of them working as I need.
But now when I tried to open (not run) one of them in the designer, it take
a lot of time (about 45 second) and almost all the time my visual Studio
2003 IDE bring a lot of errors, some of them:
1- Win32Execption: The operation completed successfully
2- Unknown error (0x0)
3- An Error has occurred with the C # compiler is unable to report due to
low memory or possible heap corruption. It is recommended that you save al
files, close and restart visual studio
The visual studio has to be close from the task manager (totally
unresponsive)
As far I tied to understand what is happening I found that the particular
form has 14 typed datasets, and if I take them out of my form it have a
normal behavior (of course, my form get a lot of errors), I put them back
one by one and the performance get worse and finaly get the same set of
errors. And not a particular dataset to blame.
My development Laptop have a Pentium M processor 2 Ghz, 1 GB of RAM, and a
big and fast H.D. with more than 50 % free space, running windows XP SP2
(firewall enable), McAffe antivirus, MS Anti SpyWare, all the Security
updates and framework 1.1 SP1.
Please some one make my day.
TIA
MajorTom Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88251
How to control Tooltip font ?
I have some data that is columnar, so would like to show it with a fixed
pitch font, such as Courier New. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88250
get control by name?
Is there a way to get the handle of a control by its name? I am writing a
help application on top of an existing .NET app. I know the friendly names
(Control.Name) of the controls in the app, I want to get a handle to those
controls using the name so I can get the location of the control and show my
help message close to the control in question. Is there anyway to get this
information from outside the existing .NET app?
- sp Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88248
Readonly Combobox
Is it possible to make a combobox Readonly with .Net 1.1
I have looked around and seen a few other people have asked this question,
but the answers have misunderstood the question.
By Readonly, I mean as in the Readonly property for a Textbox
1) You should still be able to highlight and copy text
2) The foreground and background colours should remain unchanged
3) Maybe still allow the dropdown, but different values cannot be selected
4) The current text cannot be changed in any way.
I don't care how complicated it is to do, but I really need to be able to
achieve this.
Chris Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88244
Data grid developing "sticky" fields
I have a form with a DataGrid showing search results from a database. The
DataGrid is bound to a DataView that I recreate with different sort options
and filter strings in response to user choices. I am also using a TableStyle
to control column appearance. If I put the cursor in a cell and change the
DataView, sometimes that cell "sicks" and floats above the new results. There
is no way to get rid of the stuck cell without relaunching the application.
Has anyone seen this behavior? Solutions? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88242
More app icons
Hello,
I want to add more than one icon to my .net application. One icon for
application (as usual) and second icon should be visible as "document icon".
I thing it is not possible in VS.NET, but can I use assembly linker or
something else?
--
thanks and sorry my english ;-)
Matthew Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88235
Creaing a wizard form
Hi all,
I recently moved from developing windows apps with Borland Builder to
Visual studio.net, With the Borland product I used to create wizards
using a tabcontrol, I would then add the pages i required and make the
tab for each page invisible, then when the user pressed next or back i
would move to the next or previous tab respectively. Since the tabs were
invisible they could not see them to click on them and it worked really
well.
Now I need to create a wizard in a .net app using c#, I put a tabcontrol
on my form and added a few pages to it but I can't seem to hide the
tabs, I've googled and found that you could remove the pages and only
add the one you wanted to view but this would still leave a tab at the
top of the form that they could see.
Is there a way round this or is there a better way to create a wizard
than this using .net and c#?
TIA
Joe Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88230
Toolstrip and inherited forms
Hello,
I try to use an master form with an menustrip and a statusstrip with several
items. I set the prperty modifier to public and created an inherited form
from the master. I tried to add additional toolstripitems either to the menu
or to the statusstrip without success in the designer. Adding items by code
works. What could I do to use the designer features.
Thanks for your help
Thomas Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88227
Display Internet explorer inside a windows form
Hi,
Is there a way to display (embed) an Internet Explorer inside a windows form
?
Is there any control that can do that (be an Interner browser control) ?
Thanks
Emmanuel Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88226
Web Page Content
I'm writing a windows forms application that accesses web pages. I've used
the web browser control and this works nicely.
Now I'm wondering if I can push the content (html) of a web page (as you see
from IE when you "View/Source") to a string variable (or whatever) so that I
can process it. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88225
Form is not displayed at the correct (designer) size.
Hi,
I discovered the following problem on windows forms:
DESCRIPTION
===========
1. A form (MainForm) calls another form (OtherForm) via a button.
2. OtherForm properties I have changed:
- FormBorderStyle = FixedDialog
- ControlBox = false
3. The calling form (MainForm) sets the location of the "OtherForm"
just before calling ShowDialog() method.
OtherForm f = new OtherForm();
f.Location = new Point(100,200);
f.ShowDialog();
RESULT
======
The "OtherForm" form is displayed with a wrong Size - other than the one
choosen by the designer.
Is this a BUG or what ?
Thanks
Emmanuel Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88224
Get the answers! (Dutch)
http://www.microsoft.com/netherlands/msdn/events/SDC2005.aspx Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88223
use WinForm for webpage
Hi all,
Can I use my WinForm for a ASP.net webpage? How?
Thanks
Martin Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88220
Databinding and saving changes (if any) to new row
Hi there!
I am new to databinding in .Net and I think I am going to get crazy...
What I need to do is this:
1) Create a new form for the user to enter a new Product
2) Save changes (if any) when the user closes the form
But I still couldn't get what I want, even after searching in Google.
Anyone can give me a pointer/hint?
Here is the details:
1) The form FormProduct (in which textboxes are bound) gets loaded:
private void FormProduct_Load(object sender, System.EventArgs e)
{
cmProduct = (CurrencyManager)BindingContext[dsProduct,"Products"];
LoadData();
cmProduct.AddNew();
}
2) Users either enter something or just close the form
3) Before closing the form, save any changes (I am stuck here):
private void FormProduct_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
cmProduct.EndCurrentEdit(); // Saw this in several places already
if(dsProduct.HasChanges())
SaveData();
}
The problem is this:
if I don't call cmProduct.EndCurrentEdit(), then changes will not be
detected.
But if the user hasn't entered anything, they just close the form (like
a cancel), dsProduct.HasChanges() will return true (because we added a
row in the dataset).
Any solution? Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88219
Bastardized TabControl
Greetings,
I was wondering if anyone knows if the following implementation of
TabControl exists out there.
TabControl would have 2 sets of tab pages. Both sets are aligned at the
top of TabControl, only the first set is aligned at the top-left corner
and the second - top-right.
Regards. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88218
dataGrid - Detect new row being added and prefil columns with data
I want to detect when a new row is added to my datagrid.
At that time I want to fill all the columns with some initial values
before the user gets to start editing them.
These values are not always the same, they will dpeend on who is using
the program at the time, the machine they are on and variuos other
factors.
Because of this I cannot use the solution that assigns default values
to all columns
Any ideas?
RichardF Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88211
Don't use the object: ActiveForm unless you check it for null each
Don't use the object: ActiveForm unless you check it for null each time you do.
This object is in my opinion flawed and not all that useful since it becomes
null when the form loses focus. I am posting this warning lest you too fall
into the trap of using the ActiveForm.refresh() method instead of the
tnis.refresh(); method.
They are not the same and you may or maynot find your program crashing
because you did not first check each time you call the refresh method
associated with the object again try not to use ActiveForm object and instead
use the this object of the form or the actual form itself.
I think this is a bad design for ActiveForm object. Bottom line is do not
use it unless you are absolutely forced to. Instead use the this.object
Here is the original error message I ultimately solved:
System.NullReferenceException: Object reference not set to an instance of an
object Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88209
ANN: Advanced auto-layout panels plus XAML-style interpreter for 1.1
We have released a library containing a couple of automatic layout
controls targetted at .Net 1.1 similar to the the FlowLayoutPanel and
TableLayoutPanel in Avalon. Also packaged with these are a basic
XAML-style interpreter which works well with existing Windows.Forms
controls.
These are useful for:
- creating resolution-independent applications (especially for those
who are long-sighted)
- internationalisation (automatic static text translation included in
the interpreter)
- allowing you to create central visual style rules for an application
via XSLT processing of XML script files.
Find out more at http://www.regulussystems.com/VersaForms Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88208
Creating a localized control
In my application, I am providing a plugin capability by using an interface
to specify what the plugin should do. One of the functions is
'CreateConfigurationControl' which returns a UserControl.
I am now trying to localize the application, and I'm setting the
Thread.CurrentThread.CurrentCulture and CurrentUICulture objects as the
very first thing in my Main(). The forms that are created normally are all
appearing as their localized versions, but the control that I receive from
the CreateConfigurationControl is not, even though there is a localized
version defined.
In order to actually create the control, I've tried a simple 'new
ConfigControl()' and Activator.CreateInstance, passing
Thread.CurrentThread.CurrentUICulture to the appropriate version of
CreateInstance(Type, BindingFlags, Binder, object[], CultureInfo), but I
still get back the default English version...
Any suggestions on what I might be doing wrong, or if there is an easier
way to guarantee that I get back the correct localized version of my
control?
-mdb Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88203
MeasureString() and ClearType
Hi all,
When I draw a string with TextRenderingHint.ClearTypeGridFit the width
of the drawn string is wider than what is returned by MeasureString. I
had hoped that setting the TextRenderingHint prior to calling
MeasureString would solve this, but it did not.
Any ideas on how to get the actual width of the drawn string when using
ClearType?
Thanks,
Cole Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88200
Login windows -> Child form, strange behaviour on minimize
Hi all,
I've got a typical windows form application with a login form, when I
login, the login form will be hidden and a new window will appear.
For this, I'm using .Show() method, and not .ShowDialog() because
there's a chance of reloading a different ini file during login and I
want to allow the user to reuse the login form (and it's credentials),
and when the user reloads the login form will became visible and the
the other window will became hidden.
If he really tries to login again then I will kill the new window and
create a new one.
This all works fine, the problem happens when I try to minimize the
login form, a small box appears in the left corner just like a mdi
window when we minimize it on the main form.
I would like for this "box" not to appear, and the form simply
disapears and when I press the on the icon of the taskbar the window
would appear again, just like any windows form application.
Any help?
Thanks,
Luis Miguel Pinho Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88197
How do I close an OpenFileDialog window from outside the window?
I have an application that is displaying an open file dialog window:
System.Windows.Forms.OpenFileDialog myDialog = new OpenFileDialog()
DialogResult myResult = myDialog.ShowWindow(this)
After a timeout, I want to close this dialog (basically, if the user does
nothing for a period of time, I want the dialog to close).
I have created the timer which fires at the appropriate time but I am having
difficulty finding out how to close the dialog once I receive the message.
Any suggestions appreciated. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88196
Add image to a control...reposted from languages.vb
I originally asked this in languages.vb, and someone there suggested I post
it here instead.
The requirement I've been tasked with is to have a textbox that has an image
in it (a magnifying glass) always on the right side of the textbox, but
still in the edit portion. The image should be BEHIND the text, and if
clicked on then would fire an event.
The suggestion I got from the other group (Carlos J. Quintero, the
illustrious maker of MZ-Tools) was to make it an ownerdrawn textbox. He
said that all I'd probably need to care about would be the paint event and
the click event. In VB6 I'd subclass the textbox and watch for the WM_PAINT
message, but in .Net I have NO idea where to start on this.
Can someone point me in the right direction?
Thanks.
Matt Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88195
changing the height of a columnheader in datagrids
hi
I would like to change the height of the columnheaders on a datagrid.
this is to accommodate a multiple line header title.
example:
___________
Appointment |
time |
---------------|
also to override the columnheader text alignment so that it doesn't cause
the datagrid textbox (cells)to have the same Text Alignment
Thanks Al Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88189
Localization question
I'm writing an application that needs to be localized into German. I've
set the Localizable to 'true' and the language to 'German' on my form.
I've translated all of my controls.
However, I have a UserControl on my form (which I have also localized to
German) but the designer still shows it in English. I have recompiled so I
know that the designer should know about the localized version of the
UserControl.
Is this the expected behavior, or should I see the localized German version
of my UserControl as well?
Also, is there any way I can specify on startup what language I want to
use? I'd like to run my program in "German mode" to make sure I haven't
missed anything.
Thanks!
-mdb Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88188
RichTextBox - beeping
I am programatically adding blocks of text to a RichTextBox control and it
constantly "beeps" when doing so. The program is reading an xml file line by
line and when it finds certain attributes it changes their values to a
different color. This means that a line of xml might have its color changed
several times. I thought it had to do with the changing colors but when i
commented that code out it still beeped. If i write the entire line without
substringing it together i get no beeps. It only seems to happen when i
break the line up and substring it back together.
example:
the True part will beep but the false part will not. Color changing has been
omitted since it's not a factor.
if (true)
{
rtb1.SelectedText = line.Substring(0,10); // originally set color to
black
rtb1.SelectedText = line.Substring(11,10); // changed color to red
rtb1.SelectedText = line.Substring(21,10) + "\r\n"; // changed back to
black
}
else
{
rtb1.SelectedText = line + "\r\n";
}
Anyone know why this happens and is there a way to stop it?
Thanks,
David Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88186
Multithreaded WinForms question
My application's form is handling an event raised from a worker thread in
another object. In the event handler I want to call a sub procedure that
does a number of things and among those things is accessing controls on
the form. This sub procedure normally has been called from the Click
event procedure of a button on the form so there haven't been any issues
with accessing controls from outside the UI thread. Now I have to
consider this.
I could create delegates for all the procedures I need to Invoke on the
controls but I was hoping there was a simpler way. Is there any way to
force the UI thread to call a sub procedure without using Control.Invoke
()? For example:
Private myObj As MyObject
Private Sub MainForm_Load ...
...
AddHandler myObj.SomeEvent, AddressOf MyObject_SomeEvent
...
End Sub
Private Sub MyObject_SomeEvent(ByVal whatever As Integer)
' SomeEvent is raised by a worker thread in MyObject.
' How can I force the UI thread to call SomeProcedure
' from here so I don't have to litter the SomeProcedure
' Sub with If...Then...Else structures testing
' Control.InvokeRequired() and calling Control.Invoke()
' with various custom Delegates that I have to create?
End Sub
Private Sub SomeProcedure(ByVal whatever As Integer)
... Do Stuff
SomeTextBox.Text = "Gooney Goo Goo"
...
End Sub
Hopefully I'm making sense here. I may be a little confused and not
realize it yet.
Joel Moore Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88185
custom objects in clipboard
Hi,
I am trying to put my custom object in the Clipboard but when I try to
retrive, I get "Nothing".
Let me show you how I am doing this,
' putting data into the clipboard
Dim dataObj As New System.Windows.Forms.DataObject
dataObj.SetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False, objOfMyClass)
System.Windows.Forms.Clipboard.SetDataObject(dataObj)
' retrieving from clipboard
Dim dtObj As System.windows.forms.IDataObject =
System.Windows.Forms.Clipboard.GetDataObject()
If
dtObj.GetDataPresent(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name)
Then
objOfMyClass =
CType(dtObj.GetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False), MyClass)
End If
I am getting "True" from the following command
dtObj.GetDataPresent(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name
But "Nothing" from the following one
dtObj.GetData(System.Windows.Forms.DataFormats.GetFormat("MyClass").Name,
False)
Please give your suggestions how can I fix it.
Regards,
Naeem Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88182
Control OnMouseDown and OnMouseUp called twice - surely a bug?
I'm noticing strange behaviour with System.Windows.Forms.Control.
If I press the mouse (left button), then move the mouse while still holding
it down, and then release the mouse, I get an extra set of OnMouseDown and
OnMouseUp.
So I get OnMouseDown, OnMouseUp, OnMouseDown, OnMouseUp even though the
mouse has only been pressed and released once.
Does anyone know about this? I think this is surely a bug. It's easy to
replicate. Add this code to a new user control and put an instance of the
control on a form.
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
Debug.WriteLine("OnMouseDown")
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As
System.Windows.Forms.MouseEventArgs)
Debug.WriteLine("OnMouseUp")
MyBase.OnMouseUp(e)
End Sub
You might have to try a few times to see it, but it usually only takes a few
efforts. It seems easier to replicate if I drag the mouse from the bottom of
the control towards the top!
Thanks in advance. Tag: How to access the GridItemCollection of a PropertyGrid Tag: 88181
Does any one knows how to programatically select a GridItem of a PropertyGrid?