how to create dynamic event handlers
i'm building an desktop windows app in C#. the main menu for the
application will be different depending on the admin rights of the
user. i've built the entire app. in delphi and i simply activated or
deactivated the menu items in that case, but all the menu items are
visble. i'm hoping / thinking that with .NET, i can dynamically
generate the click events for the dynamically generated menu, so that
only the menu items, that a particular user has access to will show,
along with their events. is this possible? Tag: HttpContext? Tag: 100708
Datagridview customize data display URGENT!!!!
Is there a way to show data bound to the datagridview vertically instead of
the default horizontally?
Any samples or guidance would be greatly appreciated.
Thanks in advance...
Chris Tag: HttpContext? Tag: 100707
"line break" disapears in text box after resizing the form
I put a text box on a form and set it to "multi line".
I use it to show some log information.
Every time there is some information, I use TextBox.AppendText method to add
a information string and a "\n" into the text box. There will be a line
break after the infromation string for the "\n" charactor.
But after i resized the form or click some other window on the task bar and
switch back, the line break disapears. All the text turns into only one
single line.
Is there something wrong using "\n" in multiline text box?
Is there any solution for this issue? or I should use richtextbox or detail
listview instead? Tag: HttpContext? Tag: 100706
BackgroundWorker Control for VB 2005
To Everyone,
I'm getting an InvalidOperationException for the following code sample below:
This BackgroundWorker is currently busy and cannot run multiple tasks
concurrently.
If you can reply in VB or C#, then that would be acceptable! No preference
because any help would be greatly appreciated!!
Form Load Code:
Disable.CloseButton.Disable(Me)
Me.ProgressBar1.Value = 1
'Change the cursor to wait status!
Me.Cursor = Cursors.WaitCursor
Me.BackgroundWorker1.WorkerSupportsCancellation = True
Me.BackgroundWorker1.WorkerReportsProgress = True
'Tell the background control, the secondary thread, that the work
will be done on the selected text file!
If Me.BackgroundWorker1.IsBusy = True Then
Me.BackgroundWorker1.CancelAsync()
Me.BackgroundWorker1.Equals(Nothing)
Me.BackgroundWorker1.Dispose()
Me.BackgroundWorker1.CancellationPending.Equals(True)
Me.BackgroundWorker1.RunWorkerAsync()
Else
Me.BackgroundWorker1.RunWorkerAsync()
End If
Cancel Button code:
If MsgBox("Are You Sure You Want To Cancel Generating The .LST
Files?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
If Me.BackgroundWorker1.IsBusy = True Then
Me.BackgroundWorker1.CancelAsync()
Me.BackgroundWorker1.Equals(Nothing)
Me.BackgroundWorker1.CancellationPending.Equals(True)
Me.BackgroundWorker1.Dispose()
Me.Cursor = Cursors.Default
Me.Close()
Else
Me.Cursor = Cursors.Default
Me.Close()
End If
End If
BackgroundWorker1_DoWork Code
try
''Do Stuff
'Report the progress of the operation
System.Threading.Thread.Sleep(30)
Me.BackgroundWorker1.ReportProgress(CInt(((count)) / (mMax)
* 100))
'If Cancellation is pending for whatever reason then go
ahead and cancel the operation!
If Me.BackgroundWorker1.CancellationPending = True Then
e.Cancel = True
Me.BackgroundWorker1.Dispose()
Me.BackgroundWorker1.CancelAsync()
Exit Sub
End If
Catch
'Catch errors!
End Try
BackgroundWorker1_ProgressChanged Code:
'Report the progress back to the Progress bar on the form!
Me.ProgressBar1.Value = e.ProgressPercentage
BackgroundWorker1_RunWorkerCompleted Code
If e.Cancelled Then
' The user canceled the operation.
If MsgBox("Operation was canceled", MsgBoxStyle.Exclamation) =
MsgBoxResult.Ok Then
Me.Cursor = Cursors.Default
Me.Close()
End If
ElseIf Not (e.Error Is Nothing) Then
' There was an error during the operation.
Dim msg As String = String.Format("An error occurred: {0}",
e.Error.Message)
If MsgBox(msg, MsgBoxStyle.Exclamation) = MsgBoxResult.Ok Then
Me.Cursor = Cursors.Default
Me.Close()
End If
Else
'Operation completed successfully!
If MsgBox("The .LST File(s) Were Generated Successfully!",
MsgBoxStyle.Exclamation) = MsgBoxResult.Ok Then
Me.Cursor = Cursors.Default
Me.Close()
End If
End If
--
Keal75 Tag: HttpContext? Tag: 100705
Setup Project - Prompt user for Start Menu location
Currently my setup project installs its shortcuts into a hard-coded location
under the user's Start Menu. What I want to do is to allow the user to
override this on installation (and if possible to remember that location on
upgrading). How can I do this ? Tag: HttpContext? Tag: 100704
.NET 2.0 CommonDialog - Attempt to read or write protected memory
Hello,
Iam getting this strange error with the CommonDialog box on ShowDialog.
Below is the stack trace. Any help is very much appreciated. Thank you.
****
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.
at
System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I ofn)
at System.Windows.Forms.OpenFileDialog.RunFileDialog(OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
at System.Windows.Forms.CommonDialog.ShowDialog()
at UMDCEEE.CoilDesigner.UI.CDUIElements.GetCDFileName(Boolean
forOpeningTrue) in
D:\Users\vikrant\Work\VSNET2\CoilDesigner.NET\CoilDesigner\CoilDesignerUIControls\Components\CDUIElements.cs:line 97
at UMDCEEE.CoilDesigner.UI.CDUICreator.HandleFileOpenClick(Object sender,
EventArgs e) in
D:\Users\vikrant\Work\VSNET2\CoilDesigner.NET\CoilDesigner\CoilDesignerUIControls\Components\CDUICreator.cs:line 1038
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
********
Thanks. Tag: HttpContext? Tag: 100701
PrintDialog.UseEXDialog problem
Hello All,
If I use -
ContractPrintDialog.UseEXDialog = true;
- My dialog does not get focus after showing thus having a caption (dark
bleu) of the active window, I always have to click on the dialog before I
can type or before a button responds.
When I do not use the extended dialog I do not have this problem.
Is there a work around or so.
Greets
Jean Paul
www.on7ami.be Tag: HttpContext? Tag: 100698
PrintDialog problem
Hello all,
IS this a bug or what am I doing wrong;
I make a print Dialog
ContractPrintDialog = new PrintDialog();
I set the property's of my PrinterSettings;
ContractPrintDialog.PrinterSettings.Duplex =
System.Drawing.Printing.Duplex.Horizontal;
I show my dialog.
myPrint = ContractPrintDialog.ShowDialog();
And when I go looking in the dialog to see if the duplex attribute is set,
it is always off, no mather if I set it to Horizontal, .Vertikal, Simplex or
what ever.
If I do not change the checkbox in the dialog the printer does what it has
to do on behave of my settings, evenso, if I look at my
.PrinterSettings.Duplex after colsing the dialog my pre-setting is still
there and if I change the checkbox the new setting is in the setting.
I'm using the Multilaguage-duch version of XP all patches loaded and VS-2005
Dev Team Edition Microsoft Visual Studio 2005 :
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Enterprise
Someone has a suggestion or a work arround?
Jean Paul
www.on7ami.be Tag: HttpContext? Tag: 100697
Why my NumericUpDown DataGrid Column can't set the value for new r
I've make some NumericUpDownColumn class that inherited the
DataGridTextBoxColumn and override the SetColumnValueAtRow method as below:
protected override void
SetColumnValueAtRow(System.Windows.Forms.CurrencyManager source, int rowNum,
object value)
{
try
{
base.SetColumnValueAtRow(source, _currentEditRowNum, numericUpDown.Value);
Commit(source, _currentEditRowNum);
}
catch (Exception)
{
Abort(rowNum);
}
}
And also override other methods such as Edit etc., In the
numericUpDown_Leave method, I call the SetColumnValueAtRow method.
I found it works fine for the rows that already exists in the datasource
which bound to DataGrid, but for the new added row, after I set the value and
click the mouse to other row, the value of the new row dispears. Seems that
it can't add row & set value for new row.
Does anyone could help me for this ?
Thanks!
--
Do or do not, there is no try. Tag: HttpContext? Tag: 100693
Need *formatted* value from DataGrid...possible?
Hello, all.
I have a Windows Forms app with a datagrid control, with several custom
column styles applied. One of the columns holds a decimal data type,
with a format string of "C" for currency, and this works precisely as
intended, eg the value 1234.56 is formatted as $1,234.56.
In another portion of the application, I need to get the *formatted*
rendering of that value from the grid. I've tried the simple
grid[row,col] syntax, but it merely returns the underlying value, but I
need the resultant value after the column style is applied. My ultimate
intent is to measure the width of the formatted string to autosize the
width of the column, and what I have now only formats the raw data, and
that won't work.
Is what I need even possible? I've gone through the DataGrid FAQ and
MSDN and not found what I'm needing, so I'm turning here for help.
Many thanks in advance,
-intrepid Tag: HttpContext? Tag: 100688
MC ++ reference types and their scope
Hello,
I'm back from some old fashioned project and something has changed in
comparison to my first hours of programming in Visual C++. I'm up to build a
tool and started by means of the Express Edition 2005 of VC++ aka VCM++.
I decided to use the advantages of Managed Code but I'm wondering about the
designer generated code.
It's a Windows Form App. I use Managed Strings and other built in types.
My question is if I instantiate an object of type Int32 or Double or String
have I order to delete such objects explicitly or is GC doing it.
As I can see the code designer doesn't add code to order to destroy such
objects explicitly but for one it is doing it.
System::ComponentModel::Container ^components;
and in the destructor
if (components) {
delete components;
}
As I read all members will be implicitly destroyed when they come out of
scope.
Does this also include the reference members?
I read some articles from the msdn mag and know how the finalize mechanism
works but I'm just unsure since as I started to program I used the old new,
delete mechanism which is obsolete now. Please let me know what can I do to
avoid misdesigns. May be it's to basic for the good old programer on this
thread but please help. Thanks in advance. Tag: HttpContext? Tag: 100686
Listview Disappears
I have a listview control placed on a tabpage. The tabpage is the second one
on my tabcontrol. Sometimes when I click on this second tabpage, the
listview control is not visible. I am using vb.net 2005 for development.
What would cause the control to paint sometimes and not paint at other
times? I have looked and cannot seem to find the problem.
--
Danny Tag: HttpContext? Tag: 100683
Menuitem Shortcut for AltEnter
Hi,
I've added a menuitem named "Properties" and would like to assign it the
standard Alt+Enter shortcut. Alas, the Shortcut enumeration does not contain
a value for this.
Any suggestions?
Thanks,
Jamie Tag: HttpContext? Tag: 100680
Specifying Parent to a Windows Form Where Parent Form is in VB 6
I have built a class library in Visual Basic .NET 2005 that exposes a class
as a COM class using the ComClass attribute. This COM class allows (among
other things) loading a Windows Form. I am using this .NET class library from
Visual Basic 6 as if it were a COM DLL using the new features of Visual
Studio 2005. The Visual Basic 6 application contains an MDI form. I can load
the Windows Form contained in the .NET class library from Visual Basic 6 by
means of the COM class exposed. This works fine as long as the Windows Form
is loaded as a non-child form. The problem is that I want the Windows Form to
be loaded as a child form of the Visual Basic 6 MDI form. How can I specify
to the .NET Windows Form that the parent form is a form in Visual Basic 6?
Thanks in advance! Tag: HttpContext? Tag: 100675
MySQL solutions + feedback
Hello,
Coulf you tell me, the solution you use to use MySQL 5.x database with a
winforms application ? I'd like a feedback to use the best solution.
Thanks,
C. Tag: HttpContext? Tag: 100673
Show an SQL Server Integration Services Raw File in a Datagridview
Dear all
I want to give administrators of a datawarehouse a possibility to have a
look at the extracts of the source systems a SSIS Packages puts in a
datawarehouse.
I thought the best way would be to let the package generate an Raw file
with the extract and write a .NET windows application to show this SSIS RAW
File in a .NET 2.0 DataGridView.
Unfortunately I could not find out how this works.
Can you please point me to the right direction?
Thanks, Marc
Regards,
Marc Tag: HttpContext? Tag: 100671
hide/show pane win app
Hi guys
I want to create a tabbed Modal Win app that is going to be like the
solution explorer inside the VS IDE but without the IDE, I mean an App
behaving like a hide/show pane in the left or right side of mi XP desktop
(allowing me to see the items on my desktop) , and the option to fix it or
not.
I have the idea to setup the size of the app but I donâ??t know how to
implement the hide/show behavior.
Any link where I can read?
thanks
--
Kenny M. Tag: HttpContext? Tag: 100667
VS2005 Opening a Form in Designer Sets the Modified (Dirty) Indica
I have project that has forms derived from another form in a class library.
I just converted this project to VS2005 from VS2003.
Whenever I open one of the forms the tab showing the name of the form with
an asterisk (*) so that it appears like it is modified without me making any
changes. When I click the close button it then asks me if I want to save the
changes? If I say yes and compare the before and after there is no
difference.
Has anyone seen this? I'm assuming it's probably being caused by something
in my base class (form) but I have no clue what it could be.
Any help is appreciated.
Thanks,
--
gw Tag: HttpContext? Tag: 100665
Capture maximize events of any form
Is it possible to capture the maximize event of any open form? I want to
create an app that sits in the tray and performas a tast every time a window
is maximized. Tag: HttpContext? Tag: 100659
Handling Different DPI Settings when Manually Setting Coordinates
If I'm manually setting the size and position of controls, how do I
determine what the coordinate should be if the user changes the windows
DPI setting?
I have a problem when I run an app, which was compiled in 96 dpi, in
120 DPI. I have the property, AutoScale, set to DPI.
If I manually set the size and position of any one control and get it
to show up where I want in 96 DPI, the control shows up in the wrong
place under 120 DPI. Since the DPI is higher, the X and Y coordinates
should be higher as well. I know how to detect the DPI setting. So how
do I know what values to use based on the DPI setting? Can I just
multiple all manual coordinate settings by 1.25 if the DPI is 120?
I'd like to take advantage of the Autoscale property, but I'd like to
just change the position of one or two controls depending on user
bevahior. Is this something built in or do I have to come up with
complex spacing algorithm?
Ed Tag: HttpContext? Tag: 100657
How to pass null parameter value in CR.net
I have created a report using c# and cr.net. Report fetching data from
database. I pass parameter value to report from my win form to specify what
data to fetch. If I pass null means I need to fetch all the data from table.
I wnat to know how to pass null value for a parameter.
Can any one help, or point me to another group?
Thanks,
Shailesh Tag: HttpContext? Tag: 100651
Embedded Winform resize in 2.0
I have a no-touch application which I created in 1.1. It is embedded within
IE, not a stand-alone window. I'm migrating it to 2.0 and one thing (which is
a major problem) is that the <object> tag doesn't appear to resize within the
browser frame any more. I tested the same code in 1.1 and 2.0 and something
changed. I need to figure out how to change the size of my application when
the browser changes. I've tried a bunch of options including JavaScript but
nothing appears to effect the size of the embedded .net control. Anyone have
any ideas? Tag: HttpContext? Tag: 100649
ToolStrips can never be locked on ToolStripCountainer
Hello
Is there a way to lock the ToolStrips bar on the ToolStripContainer.
I have 7 toolStrip and even if i align them in 2 lines, evertime i come
back to the programming environements, they use 7 lines !!!! And i
always have to reorganize them . Locking Controls does not help
Thanks Tag: HttpContext? Tag: 100645
slow Winform GDI performance
Hi
Is it possible to achieve 'professional looking' application in C# ?
Let me explain myself :
I have 4 panels, with inside a few simple controls (text and buttons).
Upon user selection, i hide/show the corresponding panel with
panel1.visible=true/false...
On the screen you can see that the operation is not smooth and make me
remember those VB days..
Does someone ever found a way to make the UI more professional Tag: HttpContext? Tag: 100644
Application.Restart on ClickOnce Deployed Application
We've got an application that we deploy with click once.
Using the MyApplication_UnhandledException we restart the application with
Windows.Forms.Application.Restart() if the user encounters an error we
didn't catch.
Our application allows paramaters to be passed to the ClickOnce Application
We are retrieving these like this..
If My.Application.IsNetworkDeployed Then
Dim zUri As New
Uri(My.Application.Deployment.ActivationUri.AbsoluteUri)
zstrQuery = zUri.Query
zarr_strArgs = zstrQuery.Split("&".ToCharArray)
Else....
This works fine when the appliciation is started the first time. After a
restart though, it appears that there is no ActivationUri.AbsoluteUri and I
recieve an "Object reference not set to an instance of an object" error.
What's going on? The documentation states,
"Applications are restarted in the context in which they were initially run.
If your application was started using a URL pointing directly to the
application's main executable file, it will be restarted using the same URL.
If your application is a ClickOnce application, it will be restarted using
ClickOnce.
If your application was originally supplied command-line options when it
first executed, Restart will launch the application again with the same
options."
The way I read this, it should activate the same way it did the first time,
so why is there no Uri?
--
Neil Tag: HttpContext? Tag: 100643
Flash ActiveX Control Transparency in a .NET Form
Hello folks,
Anybody knows if it is possible to display movies with transparent
background with Macromedia Flash 8 ActiveX in a .NET form? Nothing works.
Google is full of questions but no answers.
Any help would me much appreciated.
george_saz
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ Tag: HttpContext? Tag: 100641
Get letter of windows drive
Hi,
How do you get the letter of windows drive?
My software is breaking on Home box with F as C drive Tag: HttpContext? Tag: 100638
Error
Hi Friends,
I'm new to Windows forms learning it.
In VS2005 Windows Apps the code is
public Form1()
{
InitializeComponent();
Test();
}
I just pasted code to write InitializeComponent() as
private void InitializeComponent()
{
this.btnProcess = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
}
I'm getting error
Error 1 Type 'WindowsApplication1.Form1' already defines a member
called 'InitializeComponent' with the same parameter types C:\Documents
and Settings\sivarama\My Documents\Visual Studio
2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 16 21 WindowsApplication1
Pls help Tag: HttpContext? Tag: 100635
MdiParent bug...or am I dumb
Setting the MdiParent of a Form works as expected. However, if an
application has more than one top level mdi container form then unexpected
erroneous behavior is observed when setting the MdiParent of a child form
first to one MdiContainer, and then setting the MdiParent of the same child
form to another container. After setting the MdiParent for a second time,
the child will not activate and when maximized will not merge with main
menu, if available, or the title bar if there is no main menu.
Reproduce with the following code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace MDIParentBug
{
class MainForm : Form
{
Form secondMdiForm = new Form();
Form mdiChildForm = new Form();
public MainForm()
{
this.Text = "Main Mdi Form";
secondMdiForm.Text = "Second Mdi Form";
//Set as mdi containers...
secondMdiForm.IsMdiContainer = true;
this.IsMdiContainer = true;
//set the mdi parent of the child
mdiChildForm.MdiParent = this;
//Show second mdi container...
secondMdiForm.Show();
//Hook up activated events..
this.Activated += MDIParent_Activated;
secondMdiForm.Activated += MDIParent_Activated;
//show mdi child...
mdiChildForm.Show();
}
void MDIParent_Activated(object sender, EventArgs e)
{
//set new parent of mdi child...
mdiChildForm.MdiParent = sender as Form;
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
I'd like a simple fix but unfortunately I think it's truly a bug. One that's
unfortunately killing my schedule. If I'm doing something fundamentally
wrong I'd like to know.
Robert Conde Tag: HttpContext? Tag: 100634
BindingSource from WebService
Hi folks
I have a web service which publishes a dataset using the following code
(rightly or wrongly!):
[WebMethod]
public DS_Company.vwCompanyListDataTable CompanyList()
{
return taVwCompanyList.GetData(); //taVwCompanyList is a TableAdapter for my
vwCompanyList table.
}
This appears in my datasources window and I can drag "vwCompanyList" as a
gridview or details onto a form. However, when I run the form I see no data.
Do I need to do some code? What is the point of having objects you can drag
on to forms if they do not do anything???
Thanks
Will Tag: HttpContext? Tag: 100631
External component has thrown an exception
I seem to get this exception when I open forms using ShowDialog() from
event handlers. Consider the following:
private void cboCombo_SelectedIndexChanged(...)
{
try
{
(do something that raises an exception here)
}
catch(Exception ex)
{
try { (open a form with ShowDialog() here) }
catch {}
}
}
Somehow the SEHException is being thrown to Main() where it crashes the
app. The stack trace is as follows:
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WinApp.MainForm.Main(String[] args) in mainform.cs:line 2078
I've gotten around this issue in the past by starting a timer in the
event handler, and then launching the form from the timer elapsed
event. That works ok, but gets cumbersome quickly.
I can provide code samples if necessary, but the code in question
really isn't doing anything spectacular. I don't see how the code
sample above could allow an exception to be thrown (without an explicit
throw, that is).
Does anyone have any experience with this issue?
TIA Tag: HttpContext? Tag: 100630
Does ClickOnce work well? Any disadvantages to it?
We have an ASP.NET web application that gets installed on a server in a
hospital and then any computer throughout the hospital's network can
access the application. I prefer Winforms applications to ASP.NET, so
I am thinking that we should replace our current one with a Winforms
application distributed through clickonce. What are the disadvantages
of doing this? I am having difficulty convincing my coworkers that
clickonce will distribute just as easily as a web application. It
seems to me that the only major disadvantage is that the client PC has
to have the .NET framework on it, which won't be the case in general.
Does clickonce work really as easily as advertised? I scanned
newsgroups to see a bunch of people having deployment problems of one
type or another with it.
thanks in advance Tag: HttpContext? Tag: 100628
newbie... tablestyle question...
I am using vb .net 2002. I have a datagrid where I am displaying columns
from a table. The columns that are empty are being displayed as "{null}" and
I want them to be just blank. I heard the onl;y way to do this was by using
a table style to map each column and use the .nulltext="" property so that
nulls are displayed as blank...
My question is this...
There are many columns in this particular table that have null values. Is
there a way to set up a table style using a loop to go through eac field in
the table (we are using SQL server) and set the field arccordingly?? I am
currently doing it the long way and I am pretty sure there is a smarter way
to do it...
Below is some sample code for the load event of the form... In this code I
have only dim'd two columns but I have a bunch. There must be an easier way
than what I am doing here. I am think a for next loop must work but what
would the syntax be?
Private Sub frmAssetMaster_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ds As New DataSet()
Dim dgTableStyle As DataGridTableStyle
' fill the dataset
SqlDataAdapter1.Fill(ds)
Me.DataGrid1.DataSource = ds
Me.DataGrid1.DataMember = "ComputerMaster"
'Create a data grid table style.
dgTableStyle = New DataGridTableStyle()
'Map the table style to a table
dgTableStyle.MappingName = "ComputerMaster"
' Dim all of the columns you want
Dim dgTextBoxCol As New DataGridTextBoxColumn()
Dim dgTextBoxCol2 As New DataGridTextBoxColumn()
' Set Col 1 properties
dgTextBoxCol.MappingName = "ComputerName"
dgTextBoxCol.NullText = ""
dgTextBoxCol.HeaderText = "Asset Name"
'Set Col 2 properties
dgTextBoxCol2.MappingName = "RAM"
dgTextBoxCol2.NullText = ""
dgTextBoxCol2.HeaderText = "RAM"
' Add the column styles
dgTableStyle.GridColumnStyles.Add(dgTextBoxCol)
dgTableStyle.GridColumnStyles.Add(dgTextBoxCol2)
' Add the table style
Me.DataGrid1.TableStyles.Add(dgTableStyle)
End Sub Tag: HttpContext? Tag: 100625
*FileDialog for custom filesystems?
Hello,
I have a component that allows me to access a custom file system.
It has APIs for enumerating objects (folders, files) etc.
I was wondering, is there a way to easily create a FileDialog using an =
external "data provider" to browse such custom file systems?
Thanks,
Alex.
--=20
Address email to user "response" at domain "alexoren" with suffix "com" Tag: HttpContext? Tag: 100622
Word in a WinForm
I'm struggling to embed a word document in a winform application and access
the document object to automate it.
I've found http://support.microsoft.com/default.aspx?scid=KB;en-us;304662
But the code won't compile. There seems to be some conflict between the
Browser control and the SHDocVw bits.
I can get the document loaded OK, but the event mentioned in the KB article
does not seem to exist and I can find no way of getting at and binding the
instance of the document to a Word._Document object.
I can't find anything particularly useful through google and to make
matters worse, I'm using an x64 OS which may well be having issues with
64/32 bit widths (though I don't think I've got there yet).
So, simply put. In VS2005 I can load a word document in to a browser
window. How do I get teh Word Document object from it?
Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk Tag: HttpContext? Tag: 100621
CA1812 = Code Analysis
Ok, So call me dumb.
But I get a CA1812 erorr when I have a Class with Shared methods. How do I
get around this with out instantiating the class. I want it to be like a
module. Thus a static class. Which I thought I was doing be making the
methods public shared.
By the way the code works fine. But CA dosn't like it.
Any suggestions?
Thanks,
Jojo Tag: HttpContext? Tag: 100613
DatagridView displaying byte[] as an image when string is needed
I am trying to display a sha1 hash in a DataGridView. I am using the
DataBinder to bind to a SQL database. The default behavior of the
DataGridView is to display byte[] as an image, using the
DataGridViewImageCell/Column. I would like to see the sha1 hash displayed as
a string instead -- similar to the behavior I would get from Query Analyzer.
Any suggestions?
Thanks. Tag: HttpContext? Tag: 100604
How to change column width in a property grid from code?
I have a wide property grid, to display wide values. The problem is
that by default the property grid splits 50:50 between the name and
value columns.
The user can change that by dragging the divider to the left - but that
gets a bit tedious EVERY time they run the program.
Is there an easier way for my code to change the width? Neither
PropertyGrid, nor GridItem seems to have any useful properties. Tag: HttpContext? Tag: 100601
Using AxWebBrowser to get client / server conversations.
Hiya,
Got a small issue. I've created an app that can monitor what
information is sent from and to a webserver while navigating through a
particular scenario on a website (i.e. booking a holiday). Trouble is
some actions are captured, and I can get the post data / query strings
etc, however others aren't - mainly XML Posts for online games etc. I'm
currently using the BeforeNavigate method and decoding the post data to
get the information, but I think this isn't the best thing to use. So
is there another way to get this information (and more!), maybe from
the HttpWebRequest and HttpWebResponse classes (of which I am
unfamiliar with).
Any help is much appreciated,
Thanks. Tag: HttpContext? Tag: 100599
my own fonts in app
hi,
can someone provide me with some clues about fonts? i need to ship my
own fonts with the app i'm working on. what is the best approach for
this scenario? should i install these fonts on a target machine during
setup of my application? if so, what if the fonts are removed? do i need
to verify their existence on every startup?
the most resonable solution that i can think of is to embed these fonts
as a resource, but then can i use them in my app directly from resource
file? Tag: HttpContext? Tag: 100590
ToolStrip in MDI Application
Does anyone have thoughts on how to prevent a ToolStrip from leaving it's
form. I have a parent MDI ToolStrip that can be moved into the Child Form
and then lost when the child form is closed.... Tag: HttpContext? Tag: 100589
Process.Start executing old version of my EXE
Hi everyone,
>From my WinForms app I am executing an external process. It turns out
that I have replaced the EXE of the external process with a newer
version and my WinForms app is still executing the old one. I am using
Visual Studio 2005 and programming in C#.
I have been wrecking my brains for two days and I can't find a possible
explanation. These are the things I have tried so far:
-Renaming the new EXE and, of course, referencing the new name in my
code.
-Deleted all the MUICache entries in the registry.
-Removed the EXE completely from my Visual Studio solution and added it
again.
-Deleted all the suspicious caching files of Visual Studio.
-If I xcopy my app to another computer it works.
-If I xcopy my app to another folder in the same dev computer it works
only once; in subsequent runs the old version of the EXE is called
(even with a different EXE name).
This is absolutely frustrating.
I would appreciate any input.
Thanks much! Tag: HttpContext? Tag: 100587
Simple cross thread problem (I think)
I ran into a threading issue with vb.net 2005.
So I did some research and found out I could do one of two things.
I could use the following(Which I'm not a big fan of)
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf (ctl) Is TextBox Or TypeOf (ctl) Is Label Then
Control.CheckForIllegalCrossThreadCalls = False
End If
Next
or I have to use a delegate and call it like so
I like the secondary idea but I can't get my head around it. It's probably
simple and I've over complicated it but all I need to do is react to a raise
event call from a class on a form.
I have looked at all kinds of examples but I'm don't see how it applies to
my situation.
Does anyone have an example of what I need to do?
I just want to update labels and textboxes on my form when the event is
raised.
Here's the sub as it is now
Private sub mMachCtl_NotDecoded ()Handles mMachCtl.NoDecoded
txtColor.Text = "Error"
txtLotNum.Text = "Error"
Dim ctl as control
for each ctl in me.controls
if typeof ctl is label or typeof ctl is textbox then
ctl.backcolor = color.red
end if
loop
End Sub
so how do I setup the delegate, and something to make that happen?
--
You only know how far you can go if you go too far Tag: HttpContext? Tag: 100584
Two ClickOnce Questions
I have a couple of questions regarding ClickOnce:
1. We have a TabletPC application that is currently using MSDE. We are
interested in upgrading it to 2.0 and Sql Express. The question is that,
once this is done and installed on the tablets, what is the scenario if the
application requires modifications to the SQL Express database in a future
release. Does ClickOnce, for example, allow for the running of database
scripts?
2. What if some of the users are in the field and not able to log into our
internal network (we do not allow VPN access)? Can this upgrade be
accomplished from the Internet in a secure manner? Tag: HttpContext? Tag: 100583
Crystal Reports SetDataSource Method
In upgrading a Windows Forms project from 2003 to 2005 in VB.Net, I have
errors in setting the datasource for all of my embedded Crystal Report
objects.
What was working in 1.1 was
If Me.myDataAdapter.Fill(Me.myDataSet.myDataTable) > 0 Then
Dim oRpt As ReportClass = New myReport
oRpt.SetDataSource(Me.myDataSet.myDataTable)
Me.CrystalReportViewer1.ReportSource = oRpt
Return
Else : GoTo NODATA
End If
On conversion, every one of these method calls gives the error:
error BC30521: Overload resolution failed because no accessible
'SetDataSource' is most specific for these arguments:
'Public Overridable Sub SetDataSource(dataTable As
System.Data.DataTable)': Not most specific.
Any help on how to fix this would be appreciated. Thanks.
--
John Tag: HttpContext? Tag: 100582
Get new values in Tree View
I have a mdi form and I have added 2 child forms to the mdi.
1 form contains a text box and a button and the other contains a tree
view control. When I put text into the text box and press the button
the value gets entered into the database but does not reflect on the
tree view ??
Tree View takes all the values from the database while loading and does
not change after that.
Waiting for reply... :-(
Vicky... :-) Tag: HttpContext? Tag: 100581
Strange Behavior on Embedding a CMainFrame inside a managed tab control...
I know this one is WAY out pushing the envelope, but I'd like to know
if anyone has any ideas about it.
We have a behemoth of a legacy MFC application which is now being
embedded in a Windows Forms application (using VS 2005). It took some
substantial out of the box thinking to make this work, but by and large
it is working. There is one behavior, however, which we haven't quite
solved yet.
For some strange reason, we are having some significant focus
management problems. When we bring up the application, no part of the
application seems to have the focus. If we use the mouse to activate
the application, everything seems to operate correctly, but if we bring
up a modal dialog box, the dialog box receives and manages the focus
correctly, but once it is dismissed, the focus does not return to the
application window. It seems to return to the tab control, since the
arrow keys navigate the tabs, but the controls in the legacy
application cannot be reached using the keyboard.
Interestingly, modules written in C# using windows forms controls do
not display this behavior. I haven't been able to find anything in the
window management or window styles to explain this. Can anyone out
there shed any light on this?
Andrew Raymond
3RaymondResearch.com
---------------------------------------------------------------------------=
=AD-----
MCAD .NET Tag: HttpContext? Tag: 100579
PopUp Progress Bar
I've built a separate windows 2.0 form that i'm calling that has a progress
bar that runs text file parsing code. However when that form is called, it
doesn't display until the progress bar has reached it's maximum value or the
code has finished running. Is there any way to force the form to display
FIRST, then have the text file parsing code run while the progress bar
displays the progress?
Thanks and any help will be appreciated.
--
keal75 Tag: HttpContext? Tag: 100577
In Windows Forms, is there anyway to get the HttpContext for a web server
running on the localhost? TIA.