Bind Data Grid to non-datatable, but still want automatic columns

TheMSsForum.com: The Microsoft Software Forum

  • The MSS Forum ‹ Winforms
    • Archive
      • Biz
      • MCSE
      • CRM
      • Drivers
      • Framework
      • ADO
      • ASP
      • Compact
      • Forms
      • Dotnet
      • C#
      • VB
      • FontpageGen
      • Excel
      • WorkSheet
      • Exchange
      • Setup
      • Fox
      • Fontpage
      • ASP
      • IIS
      • Entourage
      • Money
      • Messanger
      • PocketPC
      • Powerpoint
      • Project
      • Publisher
      • Excel
      • VB
      • Security
      • Portal
      • Services
      • SQLServerDev
      • SVCS
      • SQLServer
      • VB
      • VC
      • MFC
      • ExcelGen
    • Previous
      • 1
        • How To: Display objects in a PropertyGrid DropDown list? I followed the MSDN example that uses a StringConverter to display states (like Ohio, Florida,) in a PropertyGrid using a DropDown list. This works fine for strings, but I would like to do this with objects I create on the fly. I think I have to create a custom TypeConverter, but I'm not sure how. Any examples would be helpful. Thanks, Steve Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67523
      • 2
        • Painting over an ActiveX-Control Hello, I am working on an enhanced HTML-Editor based on DHTMLEdit. So I created a subclass like that: public class HTMLEditor : AxDHTMLEDLib.AxDHTMLEdit I have created a lot of functions to insert Tables, Images, etc. Edit them, drag Table cells, etc... What I now basically want is to draw my own stuff in the editing window on top of that which is drawn anyway by DHTMLEdit. For example a grid like Visual Studio .NET does in HTML-View. Or drawing boxes over tables which the mouse is hovering like Frontpage 2003 does... I thought I simple override WndProc, catch WM_PAINT, let the base class do that drawing stuff and then I just paint my stuff over it, like that: protected override void WndProc(ref System.Windows.Forms.Message m) { base.WndProc(ref m); if (m.Msg == WM_PAINT) { IntPtr hDC = IntPtr.Zero; hDC = GetDC(this.Handle); Graphics g = Graphics.FromHdc(hDC); g.FillRectangle(new SolidBrush(Color.Red),0,0,100,100); g.Dispose(); ReleaseDC(this.Handle, hDC); } } I tried other things to get an instance of Graphics, like CreateGraphics-Member of Control, etc. When starting the app, I see that red rectangle, but a second later it's "hidden" by the HTMLEditor, and its never visible again. I also played around with the ControlStyles, but did not find anything that worked... Anyone has an idea? Thanks in advance, Phillip Schuster Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67522
      • 3
        • sission object Is it possible to check the session object from a windows form? I'm making a shared assembly and I want it to work with my windows forms and my asp.net forms. If asp.net is calling it I want it to check for somehitng in the session object. If the windows form is calling it then I don't want it to bypass the session check. How can I do this (c#) Thanks! Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67518
      • 4
        • Datagrid and Bound ComboBox Columns Hi, I have a tough one.. I have a datagrid that is bound to a typed dataset the following way Dim ds as New MyDataSe Datagrid.Datasource = d Datagrid.DataMembre = "BonReception" 'A datatable from my datase In that datagrid I have to combobox column (they come from a class I have made) and the combobox are bound like this ComboBoxColumn.ComboBox.DataSource = d ComboBoxColumn.ComboBox.DisplayMember = "Intervenant.TypeIntervenant" 'Another datatable from my datase ComboBoxColumn.ComboBox.ValueMember = "Intervenant.ID ComboBoxColumn.ComboBox.DataBindings.Add("SelectedValue", ds, "BonReception.TypeIntervenantID" The second combobox column's combobox use a data relation between the table Intervenant and IntervenantDetai ComboBoxColumn.ComboBox.DataSource = d ComboBoxColumn.ComboBox.DisplayMember = "Intervenant.IntervenantIntervenantDetail.Intervenant" ComboBoxColumn.ComboBox.ValueMember = "Intervenant.IntervenantIntervenantDetail.ID ComboBoxColumn.ComboBox.DataBindings.Add("SelectedValue", ds, "BonReception.IntervenantDetailID" The comboboxes in each column behave as expected, if you select a TypeIntervenant in the first combobox, the second combobox only displays the Intervenant that match the selected TypeIntervenant in the first combobox The problem is this, the data is displayed in the first combobox column, but only in the first row of the second combobox column. If I click in the first column on the second row then in the second column the first row will go blank and the second row will display it's value. If I click in the second column at any row the combobox shows up with the right value for that row If I remove the data relation between table Intervenant and IntervenantDetail, the data is displayed correctly and everything behave as expected. But I don't have the relation between the two combobox columns and I need that Here is the code for my ComboBoxColumn Class Public Class DataGridFormattableComboBoxColum Inherits DataGridColumnStyl Private isEditing As Boolea Private isReadOnly As Boolea Private _cm As CurrencyManage Private _RowNum As Intege Private WithEvents _ComboBox As New NoTabComboBo Public Event SetCellFormat As FormatCellEventHandle Public Event CurrentCellDataChanged(ByVal MappingName As String, ByVal Data As Object Public Sub New( MyBase.New( ComboBox.Visible = Fals End Su Public Property ComboBox() As NoTabComboBo Ge Return _ComboBo End Ge Set(ByVal Value As NoTabComboBox _ComboBox = Valu End Se End Propert Protected Overrides Sub Abort(ByVal rowNum As Integer isEditing = Fals Invalidate( End Su Protected Overrides Function Commit(ByVal dataSource As CurrencyManager, ByVal rowNum As Integer) As Boolea ComboBox_Leave(Nothing, Nothing Return Tru End Functio Protected Overloads Overrides Sub Edit(ByVal [source] As CurrencyManager, ByVal rowNum As Integer, ByVal bounds As Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean Dim value As Strin If Me.isEditing The Exit Su End I If MyBase.ReadOnly The Exit Su End I _cm = sourc _RowNum = rowNu If IsDBNull(GetColumnValueAtRow([source], rowNum)) The value = MyBase.NullTex If ComboBox.DataSource Is Nothing And Not ComboBox.Items.Contains(value) The ComboBox.Items.Insert(0, value End I Els value = CType(GetColumnValueAtRow([source], rowNum), String End I If cellIsVisible The ComboBox.Bounds = New Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height - 2 ComboBox.Text = valu ComboBox.Visible = Tru ComboBox.Focus( Els ComboBox.Text = valu ComboBox.Visible = Fals End I End Su Protected Overrides Function GetPreferredSize(ByVal g As Graphics, ByVal value As Object) As Siz Return New Size(100, ComboBox.PreferredHeight + 1 End Functio Protected Overrides Function GetMinimumHeight() As Integer Return ComboBox.PreferredHeight + 1 End Function Protected Overrides Function GetPreferredHeight(ByVal g As Graphics, ByVal value As Object) As Integer Return ComboBox.PreferredHeight + 1 End Function Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal [source] As CurrencyManager, ByVal rowNum As Integer) Paint(g, bounds, [source], rowNum, False) End Sub Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal [source] As CurrencyManager, ByVal rowNum As Integer, ByVal alignToRight As Boolean) Paint(g, bounds, [source], rowNum, Brushes.Red, Brushes.Blue, alignToRight) End Sub Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal [source] As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean) Dim str As Object Dim rect As Rectangle = bounds Dim e As DataGridFormatCellEventArgs e = New DataGridFormatCellEventArgs(source, rowNum, Me.MappingName, Me.DataGridTableStyle.DataGrid.Font, backBrush, foreBrush) RaiseEvent SetCellFormat(Me, e) str = GetColumnValueAtRow([source], rowNum) If IsDBNull(str) Then str = MyBase.NullText End If If Not e.UseBaseClassDrawing Then g.FillRectangle(e.BackBrush, rect) Else g.FillRectangle(backBrush, rect) End If rect.Offset(0, 2) rect.Height -= 2 Try If Not e.UseBaseClassDrawing Then g.DrawString(str, e.TextFont, e.ForeBrush, RectangleF.FromLTRB(rect.X, rect.Y, rect.Right, rect.Bottom)) Else g.DrawString(str, Me.DataGridTableStyle.DataGrid.Font, foreBrush, RectangleF.FromLTRB(rect.X, rect.Y, rect.Right, rect.Bottom)) End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub Protected Overrides Sub SetDataGridInColumn(ByVal value As DataGrid) MyBase.SetDataGridInColumn(value) If Not (ComboBox.Parent Is Nothing) Then ComboBox.Parent.Controls.Remove(ComboBox) End If If Not (value Is Nothing) Then value.Controls.Add(ComboBox) End If End Sub Private Sub ComboBox_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ComboBox.SelectedValueChanged If ComboBox.Modified Then Me.isEditing = True MyBase.ColumnStartedEditing(ComboBox) End If End Sub Protected Overrides Function GetColumnValueAtRow(ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer) As Object If Not Me.ComboBox.DataSource Is Nothing Then Try Dim obj As Object = MyBase.GetColumnValueAtRow(source, rowNum) Dim i As Integer Dim DataMember As String Dim ValueColName As String Dim DisplayColName As String Dim cm As CurrencyManager Dim dView As DataView If Me.ComboBox.DisplayMember.IndexOf(".") > -1 Then DataMember = Me.ComboBox.DisplayMember.Substring(0, Me.ComboBox.DisplayMember.LastIndexOf(".")) DisplayColName = Me.ComboBox.DisplayMember.Substring(Me.ComboBox.DisplayMember.LastIndexOf(".") + 1) Else DisplayColName = Me.ComboBox.DisplayMember End If If Me.ComboBox.ValueMember.IndexOf(".") > -1 Then ValueColName = Me.ComboBox.ValueMember.Substring(Me.ComboBox.ValueMember.LastIndexOf(".") + 1) Else ValueColName = Me.ComboBox.ValueMember End If If Me.ComboBox.DataSource.GetType.ToString.EndsWith("dsBonReception") Then cm = CType(Me.DataGridTableStyle.DataGrid.BindingContext(Me.ComboBox.DataSource, DataMember), CurrencyManager) Else cm = CType(Me.DataGridTableStyle.DataGrid.BindingContext(Me.ComboBox.DataSource), CurrencyManager) End If dView = CType(cm.List, DataView) For i = 0 To dView.Count - 1 If Not IsDBNull(obj) AndAlso Not IsDBNull(dView.Item(i).Item(ValueColName)) Then If obj = 340 And dView.Item(i).Item(ValueColName) = 340 Then Dim t As String t = "" End If End If If obj.Equals(dView.Item(i).Item(ValueColName)) Then Exit For End If Next If i < dView.Count Then Return dView.Item(i).Item(DisplayColName) End If Return DBNull.Value Catch ex As Exception MsgBox(ex.Message) End Try Else Return MyBase.GetColumnValueAtRow(source, rowNum) End If End Function Protected Overrides Sub SetColumnValueAtRow(ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal value As Object) If Not Me.ComboBox.DataSource Is Nothing Then Try Dim s As Object = value Dim DataMember As String Dim ValueColName As String Dim DisplayColName As String Dim cm As CurrencyManager Dim i As Integer Dim dView As DataView If Me.ComboBox.DisplayMember.IndexOf(".") > -1 Then DataMember = Me.ComboBox.DisplayMember.Substring(0, Me.ComboBox.DisplayMember.LastIndexOf(".")) DisplayColName = Me.ComboBox.DisplayMember.Substring(Me.ComboBox.DisplayMember.LastIndexOf(".") + 1) Else DisplayColName = Me.ComboBox.DisplayMember End If If Me.ComboBox.ValueMember.IndexOf(".") > -1 Then ValueColName = Me.ComboBox.ValueMember.Substring(Me.ComboBox.ValueMember.LastIndexOf(".") + 1) Else ValueColName = Me.ComboBox.ValueMember End If If Me.ComboBox.DataSource.GetType.ToString.EndsWith("dsBonReception") Then cm = CType(Me.DataGridTableStyle.DataGrid.BindingContext(Me.ComboBox.DataSource, DataMember), CurrencyManager) Else cm = CType(Me.DataGridTableStyle.DataGrid.BindingContext(Me.ComboBox.DataSource), CurrencyManager) End If dView = CType(cm.List, DataView) For i = 0 To dView.Count - 1 If s.Equals(dView.Item(i).Item(ValueColName)) Then Exit For End If Next If i < dView.Count Then If source.Position = rowNum Then MyBase.SetColumnValueAtRow(source, rowNum, dView.Item(i).Item(ValueColName)) End If Else If source.Position = rowNum Then MyBase.SetColumnValueAtRow(source, rowNum, DBNull.Value) End If End If Catch ex As Exception MsgBox(ex.Message) End Try Else MyBase.SetColumnValueAtRow(source, rowNum, value) End If End Sub Private Sub ComboBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ComboBox.Leave If Not isEditing Then ComboBox.Hide() Exit Sub End If isEditing = False Try Dim value As Object = ComboBox.SelectedValue If Not value Is Nothing Then SetColumnValueAtRow(_cm, _RowNum, value) RaiseEvent CurrentCellDataChanged(MyBase.MappingName, value) Else EnterNullValue() RaiseEvent CurrentCellDataChanged(MyBase.MappingName, DBNull.Value) End If Catch End Try Invalidate() ComboBox.Hide() End Sub ' ' ComboBox class removing the tab key ' Public Class NoTabComboBox Inherits ComboBox Private pModified As Boolean Private KeyPressed As Boolean Private MouseClicked As Boolean Sub New() pModified = False KeyPressed = False MouseClicked = False End Sub Protected Overrides Sub RefreshItem(ByVal index As Integer) MyBase.RefreshItem(index) End Sub Protected Overrides Sub SetItemsCore(ByVal items As System.Collections.IList) MyBase.SetItemsCore(items) End Sub Protected Overrides Function ProcessKeyMessage(ByRef m As System.Windows.Forms.Message) As Boolean If m.Msg = &H101 Then '&H101 = WM_KEYUP If m.WParam.ToInt32 = 9 Then '9 = TABKEY Return True End If End If Return MyBase.ProcessKeyMessage(m) End Function Public ReadOnly Property Modified() As Boolean Get Modified = pModified End Get End Property Protected Overrides Sub OnClick(ByVal e As System.EventArgs) MouseClicked = True End Sub Protected Overrides Sub OnSelectedValueChanged(ByVal e As System.EventArgs) If MouseClicked Or KeyPressed Then pModified = True MouseClicked = False KeyPressed = False Else pModified = False End If MyBase.OnSelectedValueChanged(e) End Sub Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs) If Char.IsLetterOrDigit(e.KeyChar) Then KeyPressed = True End If MyBase.OnKeyPress(e) End Sub End Class End Class Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67516
      • 5
        • localization to db Has anybody already tried to store the localized properties in a db instead of using satelite assemblies? Actually my question is, how do I change the "new ResourceManager(typeof(...))" at the beginning of InitializeComponent of a Form to "new MyResourceManager(...)". I actually tried it by suplying my own CodeDomSerializer but somehow only got propertyassignment-code and can't find the actualy code dom code for the new MyResourceManager(...) Has someone an idea what I'm missing? regards Chrs Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67515
      • 6
        • PrintPreviewDialog problem? I'm attempting to print graphics to a printer using a PrintPreviewDialog. The PrintPreviewDialog correctly displays what I intend to print, but when I press the Print button on the PrintPreviewDialog the printer spits out a single blank page regardless of how many pages are displayed in the dialog Below is my button click event. The PrintDocument object has not been modified after dropping it onto the form private void mniPrint_Click(object sender, System.EventArgs e tr PrintPreviewDialog ppd = new PrintPreviewDialog() ppd.Document = printDocument ppd.ShowDialog() catch (Exception ex // error handle Are there any known issues with this control Thanks Todd. Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67514
      • 7
        • List of activated fonts does not include shortcut activations Our font management tool, Suitcase, activates fonts dynamically by creating shortcuts in the Windows font folder. Using System.Drawing.Text.InstalledFontCollection to get the list of font families from the system yields only the fonts whose files are physically in the system font folder- not the shortcuts. None of our applications have any problems using the fonts activated by shortcuts. Can anyone recommend another way to retrieve the complete list of fonts? Thanks for any suggestions Josh Usovsk Code System.Drawing.Text.InstalledFontCollection installedFonts = new System.Drawing.Text.InstalledFontCollection() System.Drawing.FontFamily[] fams = installedFonts .Families; Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67512
      • 8
        • Registeresd JIT debugger is not available I have created a setup file to execute a C sharp application developed using VS.NET 2003.. I want to execute the application on a client computer (running NT 4.0), I have installed the latest microsoft .NET framework 1.1 While I am trying to execute the exe file on the client computer I am getting an error message.. Application has generated an exception that could not be handled. Process id=0x1a3(419), Thread id=0x194(404) Can anyone help me to solve this problem? Thanks. Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67511
      • 9
        • TreeView Nodes I have created a treeview control on my form. Each node has a checkbox next to it. I want to be able to click the specific node and open the correspond Word document. For example, If I click Test1 node on my treeview it will bring me to the Test1.doc document in Word. I tried several ways but none of them work. I got message saying that "The argument is out of the range". I appreciate if someone could help! Thanks in advance. Sincerely KaiTi Yen Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67510
      • 10
        • TreeView and ObjectDisposedException Hi All! I have an application that opens form with TreeView. I want to close form by AfterSelect Event: private void MyTreeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { this.Close(); } But everytime when I clicking on TreeView Item, I get following error: An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll Additional information: Cannot access a disposed object named "TreeView". Any ideas? Thank you, Vitaly Sedov Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67500
      • 11
        • TreeView and ObjectDisposedException Hi All! I have an application that opens form with TreeView. I want to close form by AfterSelect Event: private void MyTreeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { this.Close(); } But everytime when I clicking on TreeView Item, I get following error: An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll Additional information: Cannot access a disposed object named "TreeView". Any ideas? Thank you, Vitaly Sedov Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67499
      • 12
        • File Association How do I go about (programmatically) associating files created by my App with a particular icon, and how do I ensure that the app is run and loaded with a file when double-clicked - all in the same way that an App like MSWord does it Thanks in advanc Rich Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67495
      • 13
        • WinForm App and TaskManager Hi, I've a winform app and want to start the program without beeing visible in the task manager on a Windows ME box. I've seen some programs that start using the "Run" option in the registry and not appearing in the task manager. These programs are written in VC++ and I'm wondering how can I do that for my C# application? If this is not possible with an UI, can I write a background process which starts silently to monitor the other app? Remember, we're talking about a ME/98 box and have no services available. The background is that I want to prevent a user from killing my monitoring software in the task manager. Thanks for your ideas, Joerg Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67493
      • 14
        • Controlling program flow in VB.NET I am a beginner in using VB.Net although I do have experience in VB6. It always seems that I have to keep my startup object in memory otherwise the application will just end. Even if I have transfered control to another form. It is irritating to have to keep my splash screen in memory just to make sure that my application will continue running. Can anyone help me? I'm going crazy already!! Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67483
      • 15
        • How to get instance of control by name Hi, imagine having an INI-file with entries like: # key=Control / value=Text property of control controlA=bla bla bla controlB=bla bla bla controlA and controlB are different controls of types like TextBox, etc. Closing form will write INI-file, storing control names and text property of these Loading form will read INI-file and set text value of corresponding control quite a simple task, if you'll do it as follows: .... switch (iniControl) { case "controlA" : controlA.Text = iniValue; break; ... } ... But what about a more generic solution? Assuming that the key-value of INI-file is a known control, an instance within the form, what about a solution like: - get instance of the control by its name - set value from INI-file to Text-property Tried to solve this by using reflection - something like GetType(iniControl), but never suceeded. What do you think how this could be solved? Thanks and regards - Jari Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67480
      • 16
        • C# GDI+/WindowsForms Learning-Project started Hi I'm started a learning project on http://sharpgrid.sourceforge.net. Learning item is a GDI+ - based entirly written in c#. Please check code and give improvements Than Alex Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67479
      • 17
        • Search for Files with System.IO.DirectoryInfo.GetFiles() I am trying to locate all image files in a particular folder. I use the System.IO.DirectoryInfo to open information about the specific directory. I am then trying to query all of the images in that folder whether the extension be .jpg, gif, or bmp. So far I have not had any luck passing more than one extension to 'GetFiles(String searchPattern). Is there a way to pass more than one extension to this method? Also is there a better way to search for files? Something more along the lines of FindFirstFile from the Win32 API? Thanks for the help Brian Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67472
      • 18
        • Dll Import problem ** I forgot to ask one more thing, Just see the last few lines. I have a Dll written in C. And I want to Import that Dll into my C# program and use a function in the Dll. In a previous newsgroup article I saw that I may need to wrap the Dll in a C++ .NET class and then use that in my C# application. But when I run my program I get an error saying System.IO.FileNotFoundException: File or assembly name "abc", or one of its dependencies, was not found. File name: "abc" abc is my wrapper project class library. here is my wrapper class is given below. The lib name is wdll.lib and the header is dll.h. #include "dll.h" #pragma comment(lib, "wdll.lib") namespace MyWrapper { public __gc class Class1 { public: static void myfunc1(long JobNo) { _libmain(JobNo); } static char * myfunc2(void *vJobRec, short field, short subfield) { return (GETJF_NAME( vJobRec )); } }; } Here is the actual dll header file. extern "C" { void WINAPI _libmain ( long JobNo ); void * WINAPI _getjobfield ( void *vJobRec, short field, short subfield ); }; ..... and here is where I am calling it. using MyWrapper; unsafe { Class1.myfunc2(null,0,0); } It throws the exception here, System.IO.FileNotFoundException: File or assembly name "abc", or one of its dependencies, was not found. File name: "abc" ________________________________________________ So then I tried to acces the Dll in a more traditional way , but would result in the same error. Here is just a simple console application that I did, using System; using System.Runtime.InteropServices; using System.IO; using System.Reflection; using MyWrapper; namespace test { class Class1 { [DllImport("kernel32.dll", CharSet=CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName); [DllImport("wdll.dll")] public static extern IntPtr _getjobfield([MarshalAs(UnmanagedType.LPStr)] string s, short i1, short i2); [STAThread] static void Main(string[] args) { // Esure current directory is exe directory Environment.CurrentDirectory = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location ); string dllPath = Path.GetFullPath( @"C:\SoftwareDevelopment\testing\testing\test\test" ); LoadLibrary( dllPath ); Console.WriteLine( _getjobfield(null,0,0) ); } } } ******* ****************************************************************************** And in the previous mail I for got ask one more thing since _getjobfield returns a char pointer how can I read that value. currently what I am trying to do is unsafe { Class1.myfunc2(null,0,0); } but when i DO THIS unsafe { char * p = Class1.myfunc2(null,0,0); } It say's can not convert sbyte* to char*. The thing is that I am sending char* so I do not know where sbyte comes from But it throws the exception, Can any one help. Thanks Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67470
      • 19
        • Dll Import problem I have a Dll written in C. And I want to Import that Dll into my C# program and use a function in the Dll. In a previous newsgroup article I saw that I may need to wrap the Dll in a C++ .NET class and then use that in my C# application. But when I run my program I get an error saying System.IO.FileNotFoundException: File or assembly name "abc", or one of its dependencies, was not found. File name: "abc" abc is my wrapper project class library. here is my wrapper class is given below. The lib name is wdll.lib and the header is dll.h. #include "dll.h" #pragma comment(lib, "wdll.lib") namespace MyWrapper { public __gc class Class1 { public: static void myfunc1(long JobNo) { _libmain(JobNo); } static char * myfunc2(void *vJobRec, short field, short subfield) { return (GETJF_NAME( vJobRec )); } }; } Here is the actual dll header file. extern "C" { void WINAPI _libmain ( long JobNo ); void * WINAPI _getjobfield ( void *vJobRec, short field, short subfield ); }; ..... and here is where I am calling it. using MyWrapper; unsafe { Class1.myfunc2(null,0,0); } It throws the exception here, System.IO.FileNotFoundException: File or assembly name "abc", or one of its dependencies, was not found. File name: "abc" ________________________________________________ So then I tried to acces the Dll in a more traditional way , but would result in the same error. Here is just a simple console application that I did, using System; using System.Runtime.InteropServices; using System.IO; using System.Reflection; using MyWrapper; namespace test { class Class1 { [DllImport("kernel32.dll", CharSet=CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName); [DllImport("wdll.dll")] public static extern IntPtr _getjobfield([MarshalAs(UnmanagedType.LPStr)] string s, short i1, short i2); [STAThread] static void Main(string[] args) { // Esure current directory is exe directory Environment.CurrentDirectory = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location ); string dllPath = Path.GetFullPath( @"C:\SoftwareDevelopment\testing\testing\test\test" ); LoadLibrary( dllPath ); Console.WriteLine( _getjobfield(null,0,0) ); } } } But it throws the exception, Can any one help. Thanks Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67468
      • 20
        • Windows XP Button vs Framework window form button Hi, How could I create the same button and tab of windows XP in vb.net i found that the button that I create in vb.net is different with windows xp one. anyone know how to do that ? pls advise me Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67465
      • 21
        • Font Class - a big performance eater? I was curious if anybody else noticed this fact. Everytime you use the font class, especially creating multiple instances of the Font class in an iteration, there is a significant performance hit. The way I noticed was due to a bug in my code. I have a list class where each item is a separate object with various properties, among which a Font. At some point I wanted to test my list with a lot of items so I made a loop that was creating like 10000 items, but I used a constructor that passes a font too and I used new Font(...). To my surprize and astonishement, it took an average of 7 milliisecond for the framework to create each item. I got into a sort of panic, as I thought that my event model was too extensive or I forget to dispose some objects. It turned up that when I removed the Font object from the costructor with a null, the average time went from 7 milliseconds to 0.02 miliseconds!! That is like 350 times faster... Now I am even worried about any place that I might use the font constructor. Did anybody noticed this behavior in other instances? Does anyone know an optimized way of using fonts thank you Iulian Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67459
      • 22
        • Changing the default border color/appearrance of WindowsForms Short of globally changing the appearance of a WindowsForm's border color, appearrance...(like changing the color scheme in Display Properties), is there a way to change simple things like the border color at the application level Michael Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67457
      • 23
        • No-Touch Deployment app.config problem I'm having a very frustrating problem with a no-touch-deployed application and its app.config file. When it loads from a remote server, it cannot get any settings from the app.config file. In trying to locate the problem, I have tested the following things: 1. The application works flawlessly when deployed via XCopy. 2. The application works flawlessly when accessed on my own machine via http://localhost. 3. The app.config file is accessible. I can browse to it manually and download it. 4. The app.config file is being downloaded by the application and stored in the IE browser cache, but is still not accessible to the application. 5. Another application - a simple one for testing this situation - exhibits exactly the same behaviour. I have already removed the *.config mapping from IIS for the relevant directory, and, just like before, the app.config is still accessible. I have enabled anonymous access. Just like before, the app.config is still accessible. I have thus concluded that the problem is not with my server configuration. Is anyone able to offer any insight into the situation? Anyone else encountered this problem? John N Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67451
      • 24
        • capturing how a form was closed I have a 2 form application - the first form opens the second form, which allows a user to create a file. The first form then needs to do something based on how the form was closed. how the code looks Dim tf As New frmNewLeague tf.ShowDialog() If < tf closed using save button > Then do stuff else do other stuff End If Is using a global variable the best way, or can you cature how a form is closed? Derruck Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67448
      • 25
        • Radiobutton databinding: Hi, I have a radio button group which I want to bind to a table column whose value is a string. Based on the string value, I want to checkmark one of the radio buttons. Here is my code in an attempt to do this. But it fails. The events don't even fire. I don't know what I am missing. All other databindings (to text boxes and combo boxes even check boxes) seem to work fine. But then, those controls don't need datatype conversion either. Can somebody please help? CatalogsDV is a Dataview of my datasource. And I have a currencyManager that positions the data. I have no problems there since other controls seem to work. Binding b2b = new Binding("Checked", catalogsDV, Const.CATALOGTYPECOLUMN); b2b.Format += new ConvertEventHandler(FormatCatalogType); b2b.Parse += new ConvertEventHandler(ParseCatalogType); this.rdbtnB2B.DataBindings.Add(b2b); // // // // private void FormatCatalogType(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(string)) return; string ctype = (string)e.Value; if (ctype == "B2B") this.rdbtnB2B.Checked = true; else if (ctype == "B2C") this.rdbtnB2C.Checked = true; } private void ParseCatalogType(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; bool ctype = (bool)e.Value; if (ctype == true) e.Value = "B2B"; else if (ctype == false) e.Value = "B2C"; } I am confused with the complexity of Databinding. But trying to learn. I assume the above event methods are correct, at least logically. I have placed breakpoints inside both the above events. But they don't seem to fire at all. Can somebody please help? Babu. Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67430
    • Next
      • 1
        • data grid Control Using vb in vstudio .net I have implement the datagrid control in the application this is the situation I fill my datagrid with data and the scroll of the data grid not appear to be anable but it is enable mydatagrid.enable = "true", but the scroll disappear for any reason. see de jpg http://www.properlyfit.com/test.html did some body know why is this happening ? Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67429
      • 2
        • Tables don't show in drop down of tablestyle in property window of datagrid Ok I'm working on a custom IDE though it's using alot of the same technologies as the VS.Net IDE. I drag and drop the datagrid onto the form (root component) and there is a dataset with tables in the component tray. I then just set the datasource to the dataset and then the datamember to the table I desire. I then open the tablestyles and add a new one and hit the mappingname and hit the drop down and nothing shows up. What I need to find out is how the datagrid populates that list, something somewhere in my IDE isn't allowing the datagrid to populate the dropdown list with the tables in the dataset. So does anyone have any idea how that list gets populated Joe Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67427
      • 3
        • Capture Lost I'm about to modify the message loop in my winform to process the WM_CAPTURECHANGED message and fire an event, before I do I would just like to check there isn't already an event present for this? Haven't noticed one so far, but it seems strange to have it left out! :) thanks, n! Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67426
      • 4
        • Tab Control/Web Browser Control Flicker Hi, I have a tab control with a web browser control embedded in the first tab page. Whenever I resize the tab control the tab itself and web browser control flicker like crazy. Is there anyway to eliminate this flicker? Thanks in advance. Justin Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67424
      • 5
        • queueing messages Hi, Ok, since I began writing this post, I have figured out the majority of my problem. I started out without a clue about how to use messages in my application (not referring to System.Messaging, but to good old windows messages). I want a Win32 application that runs without a window. I figured out how to add a message filter to the application before calling Application.Run(). That solves the problem of catching the message. Now I cannot, for the life of me, find any references to how to put a message on the application queue. Any help would be greatly appreciated. Thanks in advance, Chris Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67417
      • 6
        • Form.AutoScroll Property .NET Framework Class Library documentation on Form.AutoScroll Property #1- If this property is set to true, scroll bars are displayed on the form if any controls are located outside the form's client region #2- Additionally, when autoscrolling is on, the client area of the form automatically scrolls to make the control with input focus visible. Q: How can I avoid #2 from happening? (override the input focus event?). I do not want the form to recenter when I click partly visible controls Thanks in advance for your help mc Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67416
      • 7
        • How to develop user-definable/configurable UIs using Windows Forms and ADO.NET? Hi, I'd like to create a data entry application in which users are able to customise the app and it's UI by adding/removing fields from the data entry form(s), changing the layout of the fields, or changing caption text. Are there any samples that show how this can be done with Windows Forms and ADO.NET?. Or perhaps books, articles, blogs or FAQs that cover this scenario? Cheers, Kunle Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67409
      • 8
        • Long texts in ComboBox's Items Hi, I have a control that holds a ComboBox. When the ComboBox gets filled the text are too long, so, it is possible to read just the half part of the text. I would like to show the whole text in a box (like the tooltipbox) while the user moves over the ComboBox's Items. Does anyone can share some code to do this? Thanx Boris Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67406
      • 9
        • Initial Flicker on Fade Out Greetings Having a bit of a problem with a fade out on a form. I'm using a timer which is enabled via a button and then this timer tick then takes the opacity down to nothing and then eventually closing the application. However, what is happening is that when the button is clicked that enables the timer and thus the first tick, the form goes all black and then then repaints to the original form and fades out smoothly. I'm sure that this does not occur on the button click event, as I've put the thread to sleep at this point, and verified that it happens upon the first firing of the tick event. Here's what I've noticed, this is much worse on forms with many controls, it actually appears if the form rolls into the center leaving the black background for just an instant before proceeding normally. Although this "rolling" may be an optical illusion. Would appreciate if anyone can assist with getting rid of the flicker..........argh... probably something stupid... Private Sub timerFade_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timerFade.Tic If Me.Opacity <= 0 The Me.Close( Els Me.Opacity = Me.Opacity - 0.0 End I End Sub Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67401
      • 10
        • DateTimePicker Bug with Microsoft.Windows.Common-Controls 6.0 We detected a bug (ValueChange Event not fired) in the DateTimePicker. The bug only occurs when we use the Microsoft.Windows.Common-Controls 6. To reproduce the bug simply create a new Solution with a windows application project Exchange the generated Form1.cs with the code below and put the manifest-file (which follows the code) in your exe-Directory (e.g. bin/Debug) Run the Application an follow the instructions ANY IDEAS TO SOLVE THE PROBLEM *************************************************************** Here ist the code of Form1.c *************************************************************** using System using System.Windows.Forms namespace WindowsApplication public class Form1 : System.Windows.Forms.For private System.Windows.Forms.DateTimePicker dtpSource private System.Windows.Forms.Button apply private System.Windows.Forms.DateTimePicker dtpTarget private System.Windows.Forms.Label label1 private System.Windows.Forms.Label label2 private System.Windows.Forms.TextBox description private System.Windows.Forms.TextBox textBox public Form1( InitializeComponent() this.description.Text = "IMPORTANT: the bug only occurs when you use Microsoft.Windows.Common-Controls 6.0 !!!\r\n + "1. Enter 27.02.2004 in Target\r\n + "2. Enter 26.02.2004 in Source\r\n + "3. Press the apply button\r\n + "4. Change target to 27.02.2004 again\r\n + "BUG: there is no valueChange event fired when you change the date to the previous value" #region Windows Form Designer generated cod private void InitializeComponent( this.dtpSource = new System.Windows.Forms.DateTimePicker() this.apply = new System.Windows.Forms.Button() this.dtpTarget = new System.Windows.Forms.DateTimePicker() this.textBox = new System.Windows.Forms.TextBox() this.label1 = new System.Windows.Forms.Label() this.label2 = new System.Windows.Forms.Label() this.description = new System.Windows.Forms.TextBox() this.SuspendLayout() // // dtpSourc // this.dtpSource.Format = System.Windows.Forms.DateTimePickerFormat.Short this.dtpSource.Location = new System.Drawing.Point(24, 168) this.dtpSource.Name = "dtpSource" this.dtpSource.Size = new System.Drawing.Size(88, 20) this.dtpSource.TabIndex = 0 this.dtpSource.Value = new System.DateTime(2004, 2, 26, 0, 0, 0, 0) // // appl // this.apply.Location = new System.Drawing.Point(128, 168) this.apply.Name = "apply" this.apply.TabIndex = 1 this.apply.Text = "apply ->" this.apply.Click += new System.EventHandler(this.apply_Click) // // dtpTarge // this.dtpTarget.Format = System.Windows.Forms.DateTimePickerFormat.Short this.dtpTarget.Location = new System.Drawing.Point(224, 168) this.dtpTarget.Name = "dtpTarget" this.dtpTarget.Size = new System.Drawing.Size(88, 20) this.dtpTarget.TabIndex = 2 this.dtpTarget.Value = new System.DateTime(2004, 2, 26, 0, 0, 0, 0) this.dtpTarget.ValueChanged += new System.EventHandler(this.dtpTarget_ValueChanged) // // textBo // this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))) this.textBox.Location = new System.Drawing.Point(24, 208) this.textBox.Multiline = true this.textBox.Name = "textBox" this.textBox.Size = new System.Drawing.Size(528, 120) this.textBox.TabIndex = 3 this.textBox.Text = "" // // label // this.label1.AutoSize = true this.label1.Location = new System.Drawing.Point(24, 152) this.label1.Name = "label1" this.label1.Size = new System.Drawing.Size(40, 16) this.label1.TabIndex = 4 this.label1.Text = "Source" // // label // this.label2.AutoSize = true this.label2.Location = new System.Drawing.Point(224, 152) this.label2.Name = "label2" this.label2.Size = new System.Drawing.Size(37, 16) this.label2.TabIndex = 4; this.label2.Text = "Target"; // // description // this.description.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.description.Location = new System.Drawing.Point(16, 16); this.description.Multiline = true; this.description.Name = "description"; this.description.ReadOnly = true; this.description.Size = new System.Drawing.Size(536, 120); this.description.TabIndex = 5; this.description.Text = ""; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(568, 347); this.Controls.Add(this.description); this.Controls.Add(this.label1); this.Controls.Add(this.textBox); this.Controls.Add(this.dtpTarget); this.Controls.Add(this.apply); this.Controls.Add(this.dtpSource); this.Controls.Add(this.label2); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run(new Form1()); } private void apply_Click(object sender, System.EventArgs e) { this.textBox.Text = string.Empty; this.dtpTarget.Value = this.dtpSource.Value; } private void dtpTarget_ValueChanged(object sender, System.EventArgs e) { string text = "ValueChanged: " + this.dtpTarget.Value + "\r\n"; this.textBox.AppendText(text); } } } **************************************************************** Here ist the WindowsApplication1.exe.manifest file: **************************************************************** <?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="WindowsApplication1" type="win32" /><description>.NET control deployment tool</description><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.10.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /></dependentAssembly></dependency></assembly> Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67400
      • 11
        • Problem with tooltip component I have created a class derived from System.Windows.Forms.TextBox. The derived TextBox also has a ToolTip component and an ErrorProvider component. When the form loads, the tool tips for all the derived text boxes work. However, as soon as I set focus in any of the derived text boxes, the tool tip for that control stops working. The error provider has no problems. Steve Binney Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67399
      • 12
        • Suspend Form Repaint? Is there a simple way to suspend a form repaint? I have several things I need to do with a form, and I want to suspend repainting it until the last item is done. Thanks. -- Dave Veeneman Chicago Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67398
      • 13
        • problems with Document2Events on W2K and XP Hi The following (shrinkwrapped) code works ok on Windows 2003 but not on Windows 2000 SP4 and XP where ALL events are blocked (e.g. context menu does not appear, impossible to write in search TextBox etc.) Framework: v1.1.4322 Dependencies on W2000: mscoree.dll 1.1.4322.573 advapi32.dll 5.0.2195.6710 urlmon.dll 6.0.2800.1400 shlwapi.dll 6.0.2800.1400 Which one is the culprit? What can I do during deployment to ensure that my program works on windows 2000 and XP? Code: Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'AxWebBrowser1 ' Me.AxWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill Me.AxWebBrowser1.Enabled = True Me.AxWebBrowser1.Location = New System.Drawing.Point(0, 0) Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State) Me.AxWebBrowser1.Size = New System.Drawing.Size(292, 273) Me.AxWebBrowser1.TabIndex = 0 ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 273) Me.Controls.Add(Me.AxWebBrowser1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxWebBrowser1.Navigate("http://www.microsoft.com";) End Sub Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete Dim Document2 As mshtml.IHTMLDocument2 = CType(AxWebBrowser1.Document, mshtml.IHTMLDocument2) Dim Document2Events As mshtml.HTMLDocumentEvents2_Event = CType(Document2, mshtml.HTMLDocumentEvents2_Event) Try RemoveHandler Document2Events.onclick, AddressOf event2b Catch 'ex As Exception : Debug.WriteLine(ex.Message) End Try Try AddHandler Document2Events.onclick, AddressOf event2b Catch ex As Exception : Debug.WriteLine(ex.Message) End Try End Sub Private Function event2b(ByVal e As mshtml.IHTMLEventObj) As Boolean e.returnValue = True Return True End Function End Class Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67396
      • 14
        • Modal MDI Child Hi all Sure this has come up plenty of times before but couldn't find it I've a form I want to display modally within an MDI app and get a "Only top level forms can be shown modally..... Any solution to this. I can't beleive it is that difficul Eldon Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67394
      • 15
        • PropertyGrid bug? Hi all, Maybe this has been said before, I'm sorry if it has. I'm making a custom EnumConverter for a propertygrid so it shows other values than the named values of the enum... this works pretty much correctly, and as expected, EXCEPT: When doubleclicking the dropdown box, moving the mouse wheel, or using an accelerator key for the dropdown, it ignores completely the ConverTo() function (which is called when the dropdown is popped up and a value selected), and just doesn't call it. This is a problem as I use this function to convert the string representation to the actual enum value, so the setter receives an string and it causes an invalid property value exception (and doesn't change the value, that is). I could surely make every setter check if it's a string and convert accordingly, but that'd be hell of a lot of work (i'm doing this for many different enums and properties), and that'd rather ruin the usefulness of the PropertyGrid. So is this a bug in the PropertyGrid, am I doing something worng, or is there something I have forgotten to do so I can convert to my enum value when the editor value is changed other than popping up the dropdown? If you need further explanation, let me know Thanks, Javier Campos Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67393
      • 16
        • Save and restore Printer Settings Hell In my windows application I need to save runtime printer settings to an XML file when it is shutting down The next time the application starts I restore them Now there is one big problem I am not able to restore the last used values in the following cases PrinterResolution.X and PrinterResolution.Y when PrinterResolutionKind = Custo PaperSource.Name if PaperSourceKind = Custo Why PaperSource and PrinterSetting constructors are Interna PrinterResolution.X, PrinterResolution.Y and PaperSource.Name are ReadOnly propertie Do you have a solution/workaround for this shortcoming Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67392
      • 17
        • Windows Service (Stopping and Staring) Hi I have developed a Windows Service When I try to start the Service it tells me that it cannot start as there may not be any work to do When I comment out below line of code in my OnStart event.... objEventLog.EnableRaisingEvents = Tru ...It starts fin I have the same issue when stopping the service because of below line of code in my OnStop even objEventLog.EnableRaisingEvents = Fals I am using .NET 2003 and I have declared objEventLog as.. Friend WithEvents objEventLog As System.Diagnostics.EventLo Does anyone have any idea as to why this is causing an issue when starting and stopping the service Thanks C Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67391
      • 18
        • PropertyGrid in UserControl doesn't reflect changes to displayed class Hello. I have a propertygrid in a usercontrol which I have placed on a form. I assign a class to this property grid in the control's constructor and it displays the properties of my class with no problem. I then invoke a method on the control which updates the class displayed in the propertygrid. When I either refresh or reassign to SelectedObject, the propertygrid fails to show any change in the underlying class. My apologies if this has been covered before - I did do search, but failed to find any posts for it (or failed to recognise them if I did :) Thanks, John Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67388
      • 19
        • XML and schema how do i validate a xml file with a schema using VB.net or C#? thanks Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67383
      • 20
        • Problem painting Linear Gradient onto WinForm I'm trying to create a WinForm with a Linear Gradient background. That's easy enough, but any Labels I have on the form do not have their background painted correctly. Even though I have Label.BackColor set to Color.Transparent, it is using the original BackColor of the Form. Here is my code, which is called in the Paint event for the Form ... private void LoginForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { LinearGradientBrush brush = new LinearGradientBrush( this.ClientRectangle, Color.Black, Color.Blue, LinearGradientMode.Vertical); e.Graphics.FillRectangle(brush, this.ClientRectangle); } Am I going to have to override the Paint event for the Label components as well and manually output the text? -- Cheers, David Clegg dclegg_at_ebetonline_dot_com "Where's the 'Any' Key?" - Homer Simpson Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67378
      • 21
        • Problem painting WinForm with Linear Gradient background I'm trying to create a form with a Linear Gradient background. Thats easy enough, but any Labels I have on the form do not have their background painted correctly. Even though I have Label.BackColor set to Color.Transparent, it is using the original BackColor of the Form. Here is my code, which is called in the Paint event for the Form ... private void LoginForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { LinearGradientBrush brush = new LinearGradientBrush( e.ClipRectangle, Color.Black, Color.Blue, LinearGradientMode.Vertical); e.Graphics.FillRectangle(brush, this.ClientRectangle); } Am I going to have to override the Paint event for the Label components as well and manually output the text? -- Cheers, David Clegg dclegg_at_ebetonline_dot_com "I know I'm not usually a praying man, but if you're up there, please Superman, help me!" - Homer Simpson Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67375
      • 22
        • Assigning Icons to Forms As always, I am asking a stupid question 1) Creating a Direct3D graphic program 2) Create my Direct3D scree 3) I want that screen to have an icon (note that I create form through code) 4) Me.Text="Title of my screen" : ' Works 4) Me.Icon ???? What would be the command here Thank you Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67365
      • 23
        • show files from database hello ng, is there a way to show a file from a database (example pdf-file), without saving the file first on hard disk? thanxs simon g. Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67361
      • 24
        • .NET application does not release Excel Let me prefix with, I've done many VB6 and ASP applications that read from/write to Excel and have never had a problem. I'm not a beginner at this... I have created my first .NET Windows application that reads from Excel 2000 and writes to a tab file. I am using the code below and when stepping through the appExcel.Quit() is executed. However, the EXCEL.EXE process still runs and will run until I close the .NET application I've built. This happens in both DEBUG and RELEASE compilations. Try appExcel = New Excel.Application() ... coding tasks ... Catch ex As Exception ... error tasks ... Finally appExcel.Quit() Any ideas why Excel is not being released after the quit? I even tried adding GC.Collect() to see if it helps to force the Garbage Collection to release appExcel. Thanks, in advance. Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67360
      • 25
        • system keys I am creating a control, based on TextBox. How do I filter DEL and other system keys Now I do it by trapping WM_KEYDOWN in WndProc override, but is not there a .NET way Thank you Tag: Bind Data Grid to non-datatable, but still want automatic columns Tag: 67359

Top

  • The MSS Forum
  • The team • All times are CDT