Search Results

Search found 4472 results on 179 pages for 'vb'.

Page 88/179 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Conversion failed: SqlParameter and DateTime

    - by Tim
    I'm changing old,vulnerable sqlcommands with SqlParameters but get a SqlException: System.Data.SqlClient.SqlException {"Conversion failed when converting datetime from character string."} on sqlCommand.ExecuteScalar() Dim sqlString As String = _ "SELECT TOP 1 " & _ "fiSL " & _ "FROM " & _ "tabData AS D " & _ "WHERE " & _ "D.SSN_Number = '@SSN_Number' " & _ "AND D.fiProductType = 1 " & _ "AND D.Repair_Completion_Date > '@Repair_Completion_Date' " & _ "ORDER BY " & _ "D.Repair_Completion_Date ASC" Dim obj As Object Dim sqlCommand As SqlCommand Try sqlCommand = New SqlCommand(sqlString, Common.MyDB.SqlConn_RM2) sqlCommand.CommandTimeout = 120 sqlCommand.Parameters.AddWithValue("@SSN_Number", myClaim.SSNNumber) sqlCommand.Parameters.AddWithValue("@Repair_Completion_Date", myClaim.RepairCompletionDate) If Common.MyDB.SqlConn_RM2.State <> System.Data.ConnectionState.Open Then Common.MyDB.SqlConn_RM2.Open() obj = sqlCommand.ExecuteScalar() Catch ex As Exception Dim debug As String = ex.ToString Finally Common.MyDB.SqlConn_RM2.Close() End Try myClaim.RepairCompletionDate is a SQLDateTime. Do i have to remove the quotes in the sqlString to compare Date columns? But then i dont get a exception but incorrect results.

    Read the article

  • Include code in ASP.net

    - by Tom Gullen
    I've got an ASP.net file, and I'm trying to include dynamic code which was easy in classic ASP. Here is what I have tried so far: <%@ Register TagPrefix="TagPre" TagName="header" Src="alg/classes.aspx"%> and <!--#include file="alg/classes.aspx"--> But neither of these seem to work. The content of classes.aspx is: <script runat="server"> ' Square class Public Class square Public sqRows As Integer 'Numbers of rows this square has Public sqCols As Integer 'Number of columns this square has Public sqArray(,) As Integer 'The square array ' Initialise square array to match size of canvas Public Sub initSqArray(ByVal canvCols, ByVal canvRows) ReDim sqArray(canvCols, canvRows) sqRows = canvRows sqCols = canvCols End Sub End Class Thanks for any help!

    Read the article

  • Why won't my anonymous function fire on grid.prerender?

    - by adam0101
    In my gridview I have fields for inserting a new record in the footer. In my objectdatasource selecting event if no records came back I bind a single mock row to force the footer to show so they can still add records. Since the row does not contain real data I hide the row. ... If result.ItemCount = 0 Then result = mockRow AddHandler mygridview.PreRender, AddressOf HideRow End If End Sub Private Sub HideRow(ByVal sender as Object, ByVal e as EventArgs) mygridview.Rows(0).Visible = False End Sub This works fine. However, I'd like to condense it like this: ... If result.ItemCount = 0 Then result = mockRow AddHandler mygridview.PreRender, Function() mygridview.Rows(0).Visible = False End If End Sub This compiles fine, but the row doesn't get hidden. Can anyone tell me why my anonymous function isn't getting hit?

    Read the article

  • Me As Child Type

    - by Steven
    I have a MustInherit Parent class with two Child classes which Inherit from the Parent. How can I use (or Cast) Me in a Parent function as the the child type of that instance? EDIT: My actual goal is to be able to serialize (BinaryFormatter.Serialize(Stream, Object)) either of my child classes. However, "repeating the code" in each child "seems" wrong.

    Read the article

  • Accessing Visio Database Reverse engineering schemas through an addin

    - by zeocrash
    I'm trying to build a visio addin that allows me to get a list of tables when a database reverse engineer is run. I'm using the Microsoft.Office.Interop.Visio library. I can find a list of shapes on the page, but this gives me every single shape on the page and every single piece of text. i would like to have a list of just the database tables (their physical names) in the document.

    Read the article

  • multithreading issue

    - by vbNewbie
    I have written a multithreaded crawler and the process is simply creating threads and having them access a list of urls to crawl. They then access the urls and parse the html content. All this seems to work fine. Now when I need to write to tables in a database is when I experience issues. I have 2 declared arraylists that will contain the content each thread parse. The first arraylist is simply the rss feed links and the other arraylist contains the different posts. I then use a for each loop to iterate one while sequentially incrementing the other and writing to the database. My problem is that each time a new thread accesses one of the lists the content is changed and this affects the iteration. I tried using nested loops but it did not work before and this works fine using a single thread.I hope this makes sense. Here is my code: SyncLock dlock For Each l As String In links finallinks.Add(l) Next End SyncLock SyncLock dlock For Each p As String In posts finalposts.Add(p) Next End SyncLock ... Dim i As Integer = 0 SyncLock dlock For Each rsslink As String In finallinks postlink = finalposts.Item(i) i = i + 1 finallinks and finalposts are the two arraylists. I did not include the rest of the code which shows the threads working but this is the essential part where my error occurs which is basically here postlink = finalposts.Item(i) i = i + 1 ERROR: index was out of range. Must be non-negative and less than the size of the collection Is there an alternative?

    Read the article

  • Appending data into Listview control

    - by strakastroukas
    In my webpage i use the following in order filling the listview control <asp:ListView ID="ListView1" runat="server"> <layouttemplate> <asp:PlaceHolder id="itemPlaceholder" runat="server" /></layouttemplate> <ItemTemplate> <tr> <td><asp:Label ID="Label1" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans1") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans1Visible") %>'></asp:Label> <br /> <asp:Label ID="Label2" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans2") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans2Visible") %>'></asp:Label> <br /> <asp:Label ID="Label3" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans3") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans3Visible") %>'></asp:Label> <br /> <asp:Label ID="Label4" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans4") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans4Visible") %>'></asp:Label> <br /> <asp:Label ID="Label5" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans5") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans5Visible") %>'></asp:Label> <br /> <asp:Label ID="Label6" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans6") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans6Visible") %>'></asp:Label> </td> </tr> </ItemTemplate> </asp:ListView> Now i would like to add numbers to the labels before they are rendered. For example currently the data displayed are like Tennis Football Basketball Nfl Nba Polo and the output i would like to have is 1. Tennis 2. Football 3. Basketball 4. Nfl 5. Nba 6. Polo Could i use ListView1_ItemCreated or the ListView1_ItemDataBound event to achieve this? If that is true, could you point me a place to start?

    Read the article

  • How do you insert 9 MB file into a Blob Field Using Oracle.DataAccess?

    - by discwiz
    Trying to insert a large audio file into an Oracle 10g database and keep getting this error: ORA-01460: unimplemented or unreasonable conversion requested The byte array length of the audio file is 2702577. The procedure works with smaller array lengths, but not the larger ones. Here is my code and Thanks! Dim oracleConnection As New OracleClient.OracleConnection Dim Cmd As New OracleClient.OracleCommand Dim oracleDataAdapter As New OracleDataAdapter oracleConnection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("MasterConnectionODT") Cmd.Connection = oracleConnection Cmd.CommandText = "Audio.ADD_AUDIO" Cmd.CommandType = CommandType.StoredProcedure Dim aParam As New OracleClient.OracleParameter aParam.ParameterName = "I_FACILITY_ID_C" aParam.OracleType = OracleType.Char aParam.Value = FacID aParam.Direction = ParameterDirection.Input Cmd.Parameters.Add(aParam) aParam = New OracleParameter aParam.ParameterName = "I_TARP_ID_N" aParam.OracleType = OracleType.Number aParam.Value = TarpID aParam.Direction = ParameterDirection.Input Cmd.Parameters.Add(aParam) aParam = New OracleParameter aParam.ParameterName = "I_AUDIO_BLOB" aParam.OracleType = OracleType.Blob aParam.Value = Audio aParam.Direction = ParameterDirection.Input Cmd.Parameters.Add(aParam) Using oracleConnection oracleConnection.Open() Cmd.ExecuteNonQuery() End Using

    Read the article

  • LINQ how to concatenate 2 db columns to display in dropdownlist

    - by Simke Nys
    I'm trying to concatenate product_name with product_prize_kg by using LINQ so I can display it as one field in a dropdownlist. When I try to do this I get the following error. value of type 'system.collections.generic.list(of anonymous type )' cannot be converted to ... My code is like this: Public Function selectAll() As List(Of tblProduct) Dim result = From product In dc.tblProducts Select New With { Key .productID = product.pk_product_id, Key .productNameKg = Convert.ToString(product.product_name) & " " & Convert.ToString(product.product_price_kg) } Return result.ToList() End Function This is the dropdownlist that I want to fill. <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1" DataTextField="productNameKg" DataValueField="productID"> </asp:DropDownList> Thanks Grtz Simke

    Read the article

  • dotNet Templated, Repeating, Databound ServerControl: Modifying underlying ServerControl data per te

    - by Campbeln
    I have a server control that wraps an underlying class which manages a number of indexes to track where it is in a dataset (ie: RenderedRecordCount, ErroredRecordCount, NewRecordCount, etc.). I've got the server control rendering great, but OnDataBinding I'm having an issue as to seems to happen after CreateChildControls and before Render (both of which properly manage the iteration of the underlying indexes). While I'm somewhat familiar with the ASP.NET page lifecycle, this one seems to be beyond me at the moment. So... How do I hook into the iterative process OnDataBinding uses so I can manage the underlying indexes? Will I have to iterate over the ITemplates myself, managing the indexes as I go or is there an easier solution? [edit: Agh... writing the problem out is very cathartic... I'm thinking this is exactly what I will need to do...] Also... I implemented the iteration of the underlying indexes during CreateChildControls originally in the belief that was the proper place to hook in for events like OnDataBinding (thinking it was done as the controls were being .Add'd). Now it seems that this may actually be unnecessary. So I guess the secondary question is: What happens during CreateChildControls? Are the unadulterated (read: with various <%-tags in place) controls added to the .Controls collection without any other processing?

    Read the article

  • DataTable Filter mystery

    - by user283897
    Hi, could you please help me find the reason of the mystery I've found? In the below code, I create a DataTable and filter it. When I use filter1, everything works as expected. When I use filter2, everything works as expected only if the SubsectionAmount variable is less than 10. As soon as I set SubsectionAmount=10, the dr2 array returns Nothing. I can't find what is wrong. Here is the code: Imports System.Data Partial Class FilterTest Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Call FilterTable() End Sub Sub FilterTable() Dim dtSubsections As New DataTable Dim SectionID As Integer, SubsectionID As Integer Dim SubsectionAmount As Integer Dim filter1 As String, filter2 As String Dim rowID As Integer Dim dr1() As DataRow, dr2() As DataRow With dtSubsections .Columns.Add("Section") .Columns.Add("Subsection") .Columns.Add("FieldString") SectionID = 1 SubsectionAmount = 10 '9 For SubsectionID = 1 To SubsectionAmount .Rows.Add(SectionID, SubsectionID, "abcd" & CStr(SubsectionID)) Next SubsectionID For rowID = 0 To .Rows.Count - 1 Response.Write(.Rows(rowID).Item(0).ToString & " " _ & .Rows(rowID).Item(1).ToString & " " _ & .Rows(rowID).Item(2).ToString & "<BR>") Next SubsectionID = 1 filter1 = "Section=" & SectionID & " AND " & "Subsection=" & SubsectionID filter2 = "Section=" & SectionID & " AND " & "Subsection=" & SubsectionID + 1 dr1 = .Select(filter1) dr2 = .Select(filter2) Response.Write(dr1.Length & "<BR>") Response.Write(dr2.Length & "<BR>") If dr1.Length > 0 Then Response.Write(dr1(0).Item("FieldString").ToString & "<BR>") End If If dr2.Length > 0 Then Response.Write(dr2(0).Item("FieldString").ToString & "<BR>") End If End With End Sub End Class

    Read the article

  • Using sqldatareader in asp.net

    - by Phil
    I have this code to get data; s = "select documents.filename, documents.description, documents.filesize from documents, contentdocuments, content where contentdocuments.contentid = content.id and content.id = @contentid and contentdocuments.documentsid = documents.id ORDER BY documents.description" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", SqlDbType.Int) x.Parameters("@contentid").Value = contentid c.Open() r = x.ExecuteReader If r.Read Then DownloadsRepeater.DataSource = r DownloadsRepeater.DataBind() **imagepath = "<img src='images/'" & getimage(r("filename")) & " border='0'** align='absmiddle'" End If c.Close() r.Close() The problem is on the line; imagepath = "<img src='images/'" & getimage(r("filename")) & " The error is; Invalid attempt to read when no data is present. How can I check to make sure data is present and get rid of this error? I thought the 'if r.read' did this? Thanks :EDIT: Function getimage(ByVal strin As String) As String If strin > "" Then dotpos = InStrRev(strin, ".") ext = Right(strin, Len(strin) - dotpos) getimage = ext & ".gif" End If Return getimage End Function

    Read the article

  • .Net Dynamically Load DLL

    - by hermiod
    I am trying to write some code that will allow me to dynamically load DLLs into my application, depending on an application setting. The idea is that the database to be accessed is set in the application settings and then this loads the appropriate DLL and assigns it to an instance of an interface for my application to access. This is my code at the moment: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim obj As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj, ICRDataLayer) MsgBox(SQLDataSource.ModuleName & vbNewLine & SQLDataSource.ModuleDescription) I have my interface (ICRDataLayer) and the SQLServer.dll contains an implementation of this interface. I just want to load the assembly and assign it to the SQLDataSource object. The above code just doesn't work. There are no exceptions thrown, even the Msgbox doesn't appear. I would've expected at least the messagebox appearing with nothing in it, but even this doesn't happen! Is there a way to determine if the loaded assembly implements a specific interface. I tried the below but this also doesn't seem to do anything! For Each loadedType As Type In ass.GetTypes If GetType(ICRDataLayer).IsAssignableFrom(loadedType) Then Dim obj1 As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj1, ICRDataLayer) End If Next EDIT: New code from Vlad's examples: Module CRDataLayerFactory Sub New() End Sub ' class name is a contract, ' should be the same for all plugins Private Function Create() As ICRDataLayer Return New SQLServer() End Function End Module Above is Module in each DLL, converted from Vlad's C# example. Below is my code to bring in the DLL: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim factory As Object = ass.CreateInstance("CRDataLayerFactory", True) Dim t As Type = factory.GetType Dim method As MethodInfo = t.GetMethod("Create") Dim obj As Object = method.Invoke(factory, Nothing) SQLDataSource = DirectCast(obj, ICRDataLayer) EDIT: Implementation based on Paul Kohler's code Dim file As String For Each file In Directory.GetFiles(baseDir, searchPattern, SearchOption.TopDirectoryOnly) Dim assemblyType As System.Type For Each assemblyType In Assembly.LoadFrom(file).GetTypes Dim s As System.Type() = assemblyType.GetInterfaces For Each ty As System.Type In s If ty.Name.Contains("ICRDataLayer") Then MsgBox(ty.Name) plugin = DirectCast(Activator.CreateInstance(assemblyType), ICRDataLayer) MessageBox.Show(plugin.ModuleName) End If Next I get the following error with this code: Unable to cast object of type 'SQLServer.CRDataSource.SQLServer' to type 'DynamicAssemblyLoading.ICRDataLayer'. The actual DLL is in a different project called SQLServer in the same solution as my implementation code. CRDataSource is a namespace and SQLServer is the actual class name of the DLL. The SQLServer class implements ICRDataLayer, so I don't understand why it wouldn't be able to cast it. Is the naming significant here, I wouldn't have thought it would be.

    Read the article

  • Converting a list of an Structure into datatable

    - by strakastroukas
    I saw a lot of examples regarding conversion of a list to data-table. I would like to convert a list of structure into a data-table. How can i do that? My structure is like ... Structure MainStruct Dim Ans1 As String Dim Ans2 As String Dim Ans3 As String Dim Skipped As Boolean End Structure and... Dim St As New MainStruct Dim Build As New List(Of MainStruct) I would like to convert the Build to a datatable

    Read the article

  • Display\Capture InnerException Message

    - by madlan
    I was using the following to provide more information on a common exception that can occour in a piece of my code, the only problem is this errors if an exception is generated that has no InnerException message. Catch ex As Exception 'MessageBox.Show(ex.Message) 'If there is no InnerException. MessageBox.Show(ex.InnerException.InnerException.Message) End Try Is there a better method of doing this?

    Read the article

  • Outlook is unable to accept french-accented characters in my mailto string?

    - by 4501
    Outlook is causing some problems when being passed a mailto string with accented characters in it. Changing the codepage for my entire webpage that has this string on it solves this problem, but that causes other problems in the system, so I would not like to do that. A string like such returns a lot of garbage characters: "mailto:[email protected]?subject=Mon bâtiment / Départementé / Bureau n'est pas répertorié" Meanwhile, this cuts off the character after the "D" "mailto:[email protected]?subject=Mon bâtiment / D&eacute;partement&#233; / Bureau n'est pas r&#233;pertori&#233;" What gives? Is there no way to make this work? I am in Canada, so some regional issues might be taking effect here?

    Read the article

  • How to display static (shared) object's properties via a Forms PropertyGrid?

    - by Paul Sasik
    I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this: _propertyGrid.SelectedObject = System.Windows.Forms.Application I get this compilation error: 'Application' is a type and cannot be used as an expression. Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?

    Read the article

  • Prevent users from being able to access a webpage via web browser?

    - by Rob
    My friend and I are working on a program. This program is going to submit GET data to our webpage. However, we don't want users accessing the webpage any other way than the program. We can prevent users from sharing the program using HWID authentication, but nothing prevents them from using a packet scanner to get the URL of the webpage. We thought about user-agent authentication, which we will implement, but user-agents can easily be spoofed. So my question is, how can we prevent users from accessing the webpage directly, instead of through the program? Even if you don't have an answer that will completely work, anything that will help deter them would be nice. Currently we will be implementing: HWID Authentication to use the program User-Agent Authentication to access the web page Instant IP Blacklisting to anyone accessing the webpage without the proper User-Agent

    Read the article

  • FormView templates break when refactored to Master/Content

    - by ZaijiaN
    Let's say I have an abstract class IA, with subclasses A1, A2, A3. For each subclass, I had a page with a FormView to insert/edit/view, with code specific to that class. The templates for insert/edit/view are all very similar, so it was mostly cut & paste, and the compiler had no problem that there were controls with the same IDs in the different templates. Something like this: <asp:FormView> <InsertItemTemplate> <asp:Label id="Label1" /> </InsertItemTemplate> <EditItemTemplate> <asp:Label id="Label1" /> </EdittItemTemplate> </asp:FormView> Much of the code/markup ended up being redundant across the pages, so I refactored it to use a master/content format, with the master page having content placeholders for the insert/edit/view templates. Master page: <asp:FormView> <InsertItemTemplate> <asp:ContentPlaceHolder ID="InsertItemTemplate"></asp:ContentPlaceHolder> </InsertItemTemplate> <EditItemTemplate> <asp:ContentPlaceHolder ID="EditItemTemplate"></asp:ContentPlaceHolder> </EdittItemTemplate> </asp:FormView> And content page: <asp:Content ContentPlaceHolderID="InsertItemTemplate"> <asp:Label id="Label1" /> </asp:Content> <asp:Content ContentPlaceHolderID="EditItemTemplate"> <asp:Label id="Label1" /> </asp:Content> In the content page templates, I'm doing the exact same thing I was doing before I refactored, but now the compiler is blowing up with the error BC30260: 'Label1' is already declared as 'Protected WithEvents Label1 As System.Web.UI.WebControls.Label' in this class. For some reason, it's not separating the controls in the content blocks the same way it did when they were in the templates, even though the content placeholders are in the individual templates. Is there a way around this, other than to rename all my controls?

    Read the article

  • Help Repainting a Line

    - by serhio
    I am doing a custom control (inherited from VisualBasic.PowerPacks.LineShape), that should be painted like as standard one, but also having a Icon displayed near it. So, I just overrided OnPaint like this: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawIcon(myIcon, StartPoint.X, StartPoint.Y); base.OnPaint(e); } Now, everything is OK, but when my control moves, the icon still remains drawn on the ancient place. Is there a way to paint it properly? The sample code for tests using Microsoft.VisualBasic.PowerPacks; using System.Windows.Forms; using System.Drawing; namespace LineShapeTest { /// /// Test Form /// public class Form1 : Form { IconLineShape myLine = new IconLineShape(); ShapeContainer shapeContainer1 = new ShapeContainer(); Panel panel1 = new Panel(); public Form1() { this.panel1.Dock = DockStyle.Fill; // load your back image here this.panel1.BackgroundImage = global::WindowsApplication22.Properties.Resources._13820t; this.panel1.Controls.Add(shapeContainer1); this.myLine.StartPoint = new Point(20, 30); this.myLine.EndPoint = new Point(80, 120); this.myLine.Parent = this.shapeContainer1; MouseEventHandler panelMouseMove = new MouseEventHandler(this.panel1_MouseMove); this.panel1.MouseMove += panelMouseMove; this.shapeContainer1.MouseMove += panelMouseMove; this.Controls.Add(panel1); } private void panel1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { myLine.StartPoint = e.Location; } } } /// /// Test LineShape /// public class IconLineShape : LineShape { Icon myIcon = SystemIcons.Exclamation; protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawIcon(myIcon, StartPoint.X, StartPoint.Y); base.OnPaint(e); } } } Nota Bene, for the lineShape: Parent = ShapeContainer Parent.Parent = Panel Update 1 TRACES In this variant of OnPaint, we have traces: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Graphics g = Parent.Parent.CreateGraphics(); g.DrawIcon(myIcon, StartPoint.X, StartPoint.Y); base.OnPaint(e); } Update 2 BLINKS In this variant of OnPaint, we have a blinking image: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Parent.Parent.Invalidate(this.Region, true); Graphics g = Parent.Parent.CreateGraphics(); g.DrawIcon(myIcon, StartPoint.X, StartPoint.Y); base.OnPaint(e); } Update 3: External Invalidation This variant works well, but... from exterior of IconLineShape class: private void panel1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Region r = myLine.Region; myLine.StartPoint = e.Location; panel1.Invalidate(r); } } /// /// Test LineShape /// public class IconLineShape : LineShape { Icon myIcon = SystemIcons.Exclamation; Graphics parentGraphics; protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { parentGraphics.DrawIcon(myIcon, StartPoint.X, StartPoint.Y); base.OnPaint(e); } protected override void OnParentChanged(System.EventArgs e) { // Parent is a ShapeContainer // Parent.Parent is a Panel parentGraphics = Parent.Parent.CreateGraphics(); base.OnParentChanged(e); } } Even this resolves the problem of the test example, I need this control to be done inside the control, because I can't force the external "clients" of this control do not forget to save the old region and invalidate the parent each time changing a location...

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >