Search Results

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

Page 111/179 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • gridview, order number + 1/- 1

    - by MyHeadHurts
    So I am working on a gridview that uses the order number to order the table. However, my users are able to ad a row. What i want is something similar to pages that have the arrows next to each row and the user can click up if they want that row to go up. I also want it to change the actual number in the row column. for the one being moved and for the other one being affected. I hope i am being clear enough

    Read the article

  • How can I draw a hollow rectangle using CreatePen?

    - by LarsTech
    Since using the DrawArc function in GDI+ isn't very accurate when drawing a small rounded rectangle, I am using RoundRect instead. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Dim hDC As IntPtr = e.Graphics.GetHdc Dim rc As New Rectangle(10, 10, 64, 24) Dim hPen As IntPtr = Win32.CreatePen(Win32.PenStyle.PS_SOLID, 0, _ ColorTranslator.ToWin32(Color.Green)) Dim hOldPen As IntPtr = Win32.SelectObject(hDC, hPen) Call Win32.RoundRect(hDC, rc.Left, rc.Top, rc.Right, rc.Bottom, 10, 10) Win32.SelectObject(hDC, hOldPen) Win32.DeleteObject(hPen) e.Graphics.ReleaseHdc(hDC) MyBase.OnPaint(e) End Sub This will draw a nice rounded rectangle, but it will also fill it with a white brush, erasing what I don't want to have erased. How can I draw this without erasing the inside of the rectangle?

    Read the article

  • ConcurrenctBag(Of MyType) Vs List(Of MyType)

    - by Ben
    What is the advantage of using a ConcurrentBag(Of MyType) against just using a List(Of MyType)? The MSDN page on the CB (http://msdn.microsoft.com/en-us/library/dd381779(v=VS.100).aspx) states that ConcurrentBag(Of T) is a thread-safe bag implementation, optimized for scenarios where the same thread will be both producing and consuming data stored in the bag So what is the advantage? I can understand the advantage of the other collection types in the Concurrency namespace, but this one puzzled me. Thanks.

    Read the article

  • SQL To Filter A SubSet Of Data

    - by Nick LaMarca
    I have an arraylist that holds a subset of names found in my database. I need to write a query to get a count of the people in the arraylist for certain sections i.e. There is a field "City" in my database from the people in the arraylist of names I want to know how many of them live in Chicago, how many live in New York etc. Can someone help me how I might set up an sql statement to handle this. I think somehow I have to pass the subset of names to sql somehow.

    Read the article

  • looping through checkboxes and inserting checkbox values to DB

    - by user1150440
    ASPX Page: <asp:ListView ID="lvSubjects" runat="server" > <LayoutTemplate> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </LayoutTemplate> <ItemTemplate> <asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" /> </ItemTemplate> <AlternatingItemTemplate> <asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" /> </AlternatingItemTemplate> </asp:ListView> Code Behind: For Each ctrl As Control In Page.Controls If TypeOf ctrl Is CheckBox AndAlso CType(ctrl, CheckBox).Checked Then '**Here I want to get the text of the check box and insert into the DB** End If Next Where am i going wrong??i do not get any error...but this code is not working for me.

    Read the article

  • Shared/Static Variable Should Be Nothing but Isn't - what gives?

    - by Denis
    I have the following code: Public Class TestClass Public Sub Test() If theGlobal IsNot Nothing Then Throw New Exception("What gives!") End Sub Private Shared theGlobal As Object = Nothing Private Shared ReadOnly Property Global Get If theGlobal Is Nothing Then theGlobal = New Object() End If Return theGlobal End Get End Property End Class Am stumped... Why is theGlobal object NOT Nothing?

    Read the article

  • Linq2SQL or EntityFramework and databinding

    - by rene marxis
    is there some way to do databinding with linq2SQL or EntityFramework using "typed links" to the bound property? Public Class Form1 Dim db As New MESDBEntities 'datacontext/ObjectContext Dim bs As New BindingSource Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load bs.DataSource = (From m In db.PROB_GROUP Select m) grid.DataSource = bs TextBox1.DataBindings.Add("Text", bs, "PGR_NAME") TextBox1.DataBindings.Add("Text", bs, db.PROB_GROUP) '**<--- Somthing like this** End Sub End Class I'd like to have type checking when compiling and the model changed.

    Read the article

  • Making a workbook visible

    - by JoeB
    I have the following code: Dim DumpXlApp As Excel.Application = New Excel.Application Dim DumpWkBk As Excel.Workbook DumpWkBk = System.Runtime.InteropServices.Marshal.BindToMoniker(FilePath) DumpXlApp = DumpWkBk.Parent DumpXlApp.Visible = True I can't get the DumpWkBk workbook to become visible. Is the issue DumpXlApp = DumpWkBk.Parent line? I don't think it is the BindToMoniker line because I can do things with DumpWkBk.

    Read the article

  • Update 2 table values in one query in LINQ

    - by fireBand
    Hello, I have 2 tables Table1 with columns [BId,Name,Amount] Table2 with columns [CId,BId, ExpenseType,Expense]. BId Is the foreign key in Table2. The Amount field in Table1 is always higher than Expense in Table2. I need to update the values of Amount (increase or decrease) based on value of Expense and I want to do it in single query in LINQ. Eg If the Expense has to be updated with 200, I would decrease(negate) Amount value with 200. If Expense is reduce to 100 then the Amount is increased by a value of 100. Thanks in advance for any suggestions.

    Read the article

  • Large transactions causing "System.Data.SqlClient.SqlException: Timeout expired" error?

    - by Michael
    My application requires a user to log in and allows them to edit a list of things. However, it seems that if the same user always logs in and out and edits the list, this user will run into a "System.Data.SqlClient.SqlException: Timeout expired." error. I've read comments about increasing the timeout period but I've also read a comment about it possibly caused by uncommitted transactions. And I do have one going in the application. I'll provide the code I'm working with and there is an IF statement in there that I was a little iffy about but it seemed like a reasonable thing to do. I'll just go over what's going on here, there is a list of objects to update or add into the database. New objects created in the application are given an ID of 0 while existing objects have their own ID's generated from the DB. If the user chooses to delete some objects, their IDs are stored in a separate list of Integers. Once the user is ready to save their changes, the two lists are passed into this method. By use of the IF statement, objects with ID of 0 are added (using the Add stored procedure) and those objects with non-zero IDs are updated (using the Update stored procedure). After all this, a FOR loop goes through all the integers in the "removal" list and uses the Delete stored procedure to remove them. A transaction is used for all this. Public Shared Sub UpdateSomethings(ByVal SomethingList As List(Of Something), ByVal RemovalList As List(Of Integer)) Using DBConnection As New SqlConnection(conn) DBConnection.Open() Dim MyTransaction As SqlTransaction MyTransaction = DBConnection.BeginTransaction() Try For Each SomethingItem As Something In SomethingList Using MyCommand As New SqlCommand() MyCommand.Connection = DBConnection If SomethingItem.ID > 0 Then MyCommand.CommandText = "UpdateSomething" Else MyCommand.CommandText = "AddSomething" End If MyCommand.Transaction = MyTransaction MyCommand.CommandType = CommandType.StoredProcedure With MyCommand.Parameters If MyCommand.CommandText = "UpdateSomething" Then .Add("@id", SqlDbType.Int).Value = SomethingItem.ID End If .Add("@stuff", SqlDbType.Varchar).Value = SomethingItem.Stuff End With MyCommand.ExecuteNonQuery() End Using Next For Each ID As Integer In RemovalList Using MyCommand As New SqlCommand("DeleteSomething", DBConnection) MyCommand.Transaction = MyTransaction MyCommand.CommandType = CommandType.StoredProcedure With MyCommand.Parameters .Add("@id", SqlDbType.Int).Value = ID End With MyCommand.ExecuteNonQuery() End Using Next MyTransaction.Commit() Catch ex As Exception MyTransaction.Rollback() 'Exception handling goes here End Try End Using End Sub There are three stored procedures used here as well as some looping so I can see how something can be holding everything up if the list is large enough. Other users can log in to the system at the same time just fine though. I'm using Visual Studio 2008 to debug and am using SQL Server 2000 for the DB.

    Read the article

  • Disposing a Bitmap through its Finalizer

    - by devoured elysium
    I have a complex program in which I have to first create, then use wrappers around bitmaps and send them across a lot of different classes. The problem in the end is deciding which classes should dispose the bitmaps. Most of the time the end classes don't know if they can indeed dispose the bitmap as the same bitmap can be used in several places. Also, I can't just copy the bitmaps because this is a kind of resource intensive algorithm and doing it would be dead slow. I looked up on reflector for Image/Bitmap's implementations and they seem to use the Dispose Pattern. So, even if I don't call Dispose(), the CLR will eventually call it some other time. Is it too bad if I just let the bitmaps be as they are, and let the finalizer take care of them?

    Read the article

  • An example of advanced database search

    - by Phil
    Hi there, im looking for an example script. I saw one yesterday but for the life of me I can't find it again today. The task I have is to allow the user to search 1 database table via input controls on an aspx page where they can select and , or , equals to combine fields, generating the sql on the fly with a stringbuilder or similar. (it runs behind the corp firewall) Please can someone point me in the right direction of an example or tutorial I've been working on the page, but have run into problems. Here is a snippet; If NameSearch.Text IsNot String.Empty And andor1v IsNot "0" Then sql += "Surname LIKE '%" & name & "%' " & andor1v & " " ElseIf NameSearch.Text IsNot String.Empty And andor1v Is "0" Then sql += "Surname LIKE '%" & name & "%' " End If

    Read the article

  • When should I implement IDisposeable?

    - by Bobby
    What is the best practice for when to implement IDisposeable? Is the best rule of thumb to implement it if you have one managed object in the class, or does it depend if the object was created in the class or just passed in? Should I also do it for classes with no managed objects at all?

    Read the article

  • getting HtmlTextWriter of a control

    - by lissa
    is it possible to get HtmlTextWriter of a control? if no, then how can i call the RenderEndTag of a control in code behind? i am facing a problem in my application. i extended the listbox user control and override its RenderEndTag event. if i used the new listbox (Mylistbox) normally inside a WebPage, everything works fine. but when i put Mylistbox in a Webusercontrol and include the Webusercontrol in a WebPage, the RenderEndTag of the control is not called for some reason. so i guessed that i should explicitly call 'RenderEndTag' of the control. to do so i need to pass an HtmlTextWriter...

    Read the article

  • c#: storing lots of data in my.settings

    - by every_answer_gets_a_point
    i will need to store 3 tables of data instead of implementing an entire database backend, i just want to store the record for these tables in application.settings has anyone done this before? i dont care about security is it advisable to do it with application settings? how else would you do it? perhaps storing a matrix in application.settings would be OK?

    Read the article

  • What is the difference between Equals and = in LINQ?

    - by sunpech
    What is the difference between Equals and = in LINQ? Dim list As List(Of Foo) = (From a As Foo In FooList _ Join b As Bar In BarList _ On a.Something = b.Something _ Select a).ToList() versus Dim list As List(Of Foo) = (From a As Foo In FooList _ Join b As Bar In BarList _ On a.Something Equals b.Something _ Select a).ToList()

    Read the article

  • Accessing XAML Object Variables in XAML

    - by Asryael
    So, what I'm trying to do is access my Form's width and/or height to use in a storyboard. Essentially, I have a Translate Transform animation to slide what are essentially two pages. The animation works fine with hard coded From/To variables, however I need to use soft variables that enable the animation to start from the left/right of my form no matter what size it is. <Storyboard x:Key="SlideLeftToRight" TargetProperty="RenderTransform.(TranslateTransform.X)" AccelerationRatio=".4" DecelerationRatio=".4"> <DoubleAnimation Storyboard.TargetName="PageViewer" Duration="0:0:0.6" From="WindowWidth" To="0"/> <DoubleAnimation Storyboard.TargetName="BorderVisual" Duration="0:0:0.6" From="0" To="NegativeWindowWidth"/> </Storyboard> However, I have no idea how to do so. Any help is greatly appreciated. EDIT: I'm guessing it has something to do with: From="{Binding Width, Source=MainWindow}" However, when I attempt this, I don't know how to make it negative.

    Read the article

  • MC75 using symbol.imaging.device libraries for program

    - by Christy
    UPDATE: I found another library in the Windows Mobile - CameraCaptureDialog - this did the job - never did figure out the zero length available devices... Hi all, I have a .net application running on a symbol mc75 (motorola) using the scanner. I am now trying to add functionality for the camera and I am running into issues. To find the 'devices' you are supposed to use the library's 'available devices' function. With the barcode it is symbol.barcode.devices.availabledevices and it returns two items (you can scan from the scanner or using the camera device) However, when I do the camera library it does not find any devices - symbol.imaging.devices.availabledevices returns 0 I can take a picture using the software on the mc75, so I know the functionality is there, I just can't figure out how to get to it programmatically.... Does anyone have any ideas? Thanks for any help!

    Read the article

  • Invalid Cast Exception with Update Panel

    - by user1593175
    On Button Click Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click MsgBox("INSIDE") If SocialAuthUser.IsLoggedIn Then Dim accountId As Integer = BLL.getAccIDFromSocialAuthSession Dim AlbumID As Integer = BLL.createAndReturnNewAlbumId(txtStoryTitle.Text.Trim, "") Dim URL As String = BLL.getAlbumPicUrl(txtStoryTitle.Text.Trim) Dim dt As New DataTable dt.Columns.Add("PictureID") dt.Columns.Add("AccountID") dt.Columns.Add("AlbumID") dt.Columns.Add("URL") dt.Columns.Add("Thumbnail") dt.Columns.Add("Description") dt.Columns.Add("AlbumCover") dt.Columns.Add("Tags") dt.Columns.Add("Votes") dt.Columns.Add("Abused") dt.Columns.Add("isActive") Dim Row As DataRow Dim uniqueFileName As String = "" If Session("ID") Is Nothing Then lblMessage.Text = "You don't seem to have uploaded any pictures." Exit Sub Else **Dim FileCount As Integer = Request.Form(Request.Form.Count - 2)** Dim FileName, TargetName As String Try Dim Path As String = Server.MapPath(BLL.getAlbumPicUrl(txtStoryTitle.Text.Trim)) If Not IO.Directory.Exists(Path) Then IO.Directory.CreateDirectory(Path) End If Dim StartIndex As Integer Dim PicCount As Integer For i As Integer = 0 To Request.Form.Count - 1 If Request.Form(i).ToLower.Contains("jpg") Or Request.Form(i).ToLower.Contains("gif") Or Request.Form(i).ToLower.Contains("png") Then StartIndex = i + 1 Exit For End If Next For i As Integer = StartIndex To Request.Form.Count - 4 Step 3 FileName = Request.Form(i) '## If part here is not kaam ka..but still using it for worst case scenario If IO.File.Exists(Path & FileName) Then TargetName = Path & FileName 'MsgBox(TargetName & "--- 1") Dim j As Integer = 1 While IO.File.Exists(TargetName) TargetName = Path & IO.Path.GetFileNameWithoutExtension(FileName) & "(" & j & ")" & IO.Path.GetExtension(FileName) j += 1 End While Else uniqueFileName = Guid.NewGuid.ToString & "__" & FileName TargetName = Path & uniqueFileName End If IO.File.Move(Server.MapPath("~/TempUploads/" & Session("ID") & "/" & FileName), TargetName) PicCount += 1 Row = dt.NewRow() Row(1) = accountId Row(2) = AlbumID Row(3) = URL & uniqueFileName Row(4) = "" Row(5) = "No Desc" Row(6) = "False" Row(7) = "" Row(8) = "0" Row(9) = "0" Row(10) = "True" dt.Rows.Add(Row) Next If BLL.insertImagesIntoAlbum(dt) Then lblMessage.Text = PicCount & IIf(PicCount = 1, " Picture", " Pictures") & " Saved!" lblMessage.ForeColor = Drawing.Color.Black Dim db As SqlDatabase = Connection.connection Using cmd As DbCommand = db.GetSqlStringCommand("SELECT PictureID,URL FROM AlbumPictures WHERE AlbumID=@AlbumID AND AccountID=@AccountID") db.AddInParameter(cmd, "AlbumID", Data.DbType.Int32, AlbumID) db.AddInParameter(cmd, "AccountID", Data.DbType.Int32, accountId) Using ds As DataSet = db.ExecuteDataSet(cmd) If ds.Tables(0).Rows.Count > 0 Then ListView1.DataSource = ds.Tables(0) ListView1.DataBind() Else lblMessage.Text = "No Such Album Exists." End If End Using End Using 'WebNavigator.GoToResponseRedirect(WebNavigator.URLFor.ReturnUrl("~/Memories/SortImages.aspx?id=" & AlbumID)) Else 'TODO:we'll show some error msg End If Catch ex As Exception MsgBox(ex.Message) lblMessage.Text = "Oo Poop!!" End Try End If Else WebNavigator.GoToResponseRedirect(WebNavigator.URLFor.LoginWithReturnUrl("~/Memories/CreateAlbum.aspx")) Exit Sub End If End Sub The above code works fine.I have added an Update Panel in the page to avoid post back, But when i add the button click as a trigger <Triggers> <asp:AsyncPostBackTrigger ControlID="btnSubmit" /> </Triggers> in the update panel to avoid post back, i get the following error.This happens when i add the button click as a Trigger to the update panel.

    Read the article

  • Declaring an object of a conditional type with a System.Type

    - by Chapso
    I am attempting to launch a specific form depending on the selected node of a treeview on the doubleclick event. The code I need to use to launch the form is a little bulky becuase I have to ensure that the form is not disposed, and that the form is not already open, before launching a new instance. I'd like to have all of this checking happen in one place at the end of the function, which means that I have to be able to pass the right form type to the code at the end. I'm trying to do this with a System.Type, but that doesn't seem to be working. Could someone point me in the right direction, please? With TreeView.SelectedNode Dim formType As Type Select Case .Text Case "Email to VPs" formType = EmailForm.GetType() Case "Revise Replacers" formType = DedicatedReplacerForm.GetType() Case "Start Email" formType = EmailForm.GetType() End Select Dim form As formType Dim form As formType Try form = CType(.Tag, formType) If Not form.IsDisposed Then form.Activate() Exit Sub End If Catch ex As NullReferenceException 'This will error out the first time it is run as the form has not yet ' been defined. End Try form = New formType form.MdiParent = Me .Tag = form CType(TreeView.SelectedNode.Tag, Form).Show() End With

    Read the article

  • Possible to implement an IsViewPortVisible dependencyproperty for an item in an ItemsControl?

    - by Matt H.
    I need to enable/disable spell checking in a richtextbox in an ItemsControl, based on whether the RichTextBox is visible in the ItemsControl's Scrollviewer. I think the route is to implement an IsViewPortVisible dependency property and wire an event handler for a changed event... I found this article that describes the lengthy process for determining if an item is in the viewport: http://social.msdn.microsoft.com/Forums/en/wpf/thread/e6ccfec3-3dc0-4702-9d0d-1cfa55ecfc90 Any ideas on where to start? I'm familiar with implementing my own dependency property for the sake of simple bindings (integers, strings, etc...). I have no idea how to undergo something like this though) This is the end result I'm hoping for: <DataTemplate> <Grid> ...Stuff in the Grid <local:CustomRichTextBox SpellCheck.IsEnabled={Binding RelativeSource={RelativeSource Self}, Path=IsViewPortVisible}/> </Grid> </DataTemplate> Help will be EXTREMELY appreciated... you'll be saving me about 500MB in memory consumption while the program is running!!!! :)

    Read the article

  • export gridview data

    - by Eric
    What is the best way to export a gridview into an Excel spreadsheet? This seems easy except that my Gridview doesn't have an export attribute. What is the quickest way to do this?

    Read the article

  • Set MdiParent to null (Nothing) in FormClosed

    - by serhio
    In my project I observed that in a FormClosed method (that handles FormClosed event) is set MdiParent = Nothing (null). This code makes (? no idea why) that OnLoad(method) on some child panels is raised. Is there any sense to set MdiParent to null (Nothing) in FormClosed?

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >