Search Results

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

Page 93/179 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • How to translate legacy system colors to (A)RGB?

    - by Paul Sasik
    I have a list of color values encoded as signed integers in a legacy INI file that I need to translate into (A)RGB values with .NET. An INI example: [INI_Section] Color=-2147483633 Doing something like: Color.FromArgb(-2147483633) gives an alpha-blended version of a color that is not at all what I expect. Is there a .NET method for translating these legacy colors properly? Note that pInvoke to OlePro32.dll is not an option.

    Read the article

  • DroDownlist in DataGrid produces Error

    - by S Nash
    I have a DataGrid and everytime I change value of it's embeded dropdwonlist I get: "System.Web.HttpException: The IListSource does not contain any data sources." I have a data grid which loads fine: Name column is editable. I have a dropdownlist these : DataDataGrid gets its value from a table. (Select Name, Address From Persons) Dropdown list also gets list of names from the same table. So DataGrid and dropdownlist are bound to 2 different datasets. Here is my code for dataGrid" <Columns> <ASP:ButtonColumn Text="Delete" CommandName="Delete"></ASP:ButtonColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> <ASP:TemplateColumn HeaderText="Name" SortExpression="FY" HeaderStyle-HorizontalAlign="center" HeaderStyle-Wrap="True"> <ItemStyle Wrap="false" HorizontalAlign="left" /> <ItemTemplate> <ASP:Label ID="Name" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' runat="server"/> </ItemTemplate> <EditItemTemplate> <ASP:DropDownList id="ddlName" cssClass="DropDownList" runat="server" datasource="<%#allNames%>" DataTextField= "Name" DataValueField="ID" Defaultvalue='<%# DataBinder.Eval(Container.DataItem, "ID") %>' OnPreRender="SetDefaultListItem" accessKey="I" AutoPostBack="true" /> </EditItemTemplate> </ASP:TemplateColumn> <asp:BoundColumn DataField="Address" ReadOnly="True" HeaderText="Address"></asp:BoundColumn> </Columns> Error happens here : dg.DataSource = ds dg.DataBind() Any ideas how to solve this issues? All I want is a DataGrid with a editable column ,which can be edited by choosing one of the value of in a dropdownlist.

    Read the article

  • to change the style of div

    - by ramyatk06
    hi guys, I have 2 buttons and 2 divs div1 and div2.On click button1 div1 is made visible and div2 invisible,On clicking button2 div2 is made visible and div1 is invisible. For that i used javascript. function showdiv2() { document.getElementById("div2").style.visibility="visible"; document.getElementById("div2").style.display="inline"; document.getElementById("div1").style.visibility="hidden"; document.getElementById("div1").style.display = "none"; document.getElementById("lbl_msg").innerHTML = "" } function showdiv1() { document.getElementById("div1").style.visibility="visible"; document.getElementById("div1").style.display="inline"; document.getElementById("div2").style.visibility="hidden"; document.getElementById("div2").style.display = "none"; document.getElementById("lbl_msg").innerHTML = "" } In div2 i have a gridview in which i have a linkbutton named lnkDelete.In its click control is going to div1.In click of lnkDelete,i want to make div1 invisible,but on clicking button1 div1 should be visible.Can anybody help to make div1 invisible in clickevent of lnkDelete in codebehind?

    Read the article

  • adapting combination code for larger list

    - by vbNewbie
    I have the following code to generate combinations of string for a small list and would like to adapt this for a large list of over 300 string words.Can anyone suggest how to alter this code or to use a different method. Public Class combinations Public Shared Sub main() Dim myAnimals As String = "cat dog horse ape hen mouse" Dim myAnimalCombinations As String() = BuildCombinations(myAnimals) For Each combination As String In myAnimalCombinations 'Look on the Output Tab for the results! Console.WriteLine("(" & combination & ")") Next combination Console.ReadLine() End Sub Public Shared Function BuildCombinations(ByVal inputString As String) As String() 'Separate the sentence into useable words. Dim wordsArray As String() = inputString.Split(" ".ToCharArray) 'A plase to store the results as we build them Dim returnArray() As String = New String() {""} 'The 'combination level' that we're up to Dim wordDistance As Integer = 1 'Go through all the combination levels... For wordDistance = 1 To wordsArray.GetUpperBound(0) 'Go through all the words at this combination level... For wordIndex As Integer = 0 To wordsArray.GetUpperBound(0) - wordDistance 'Get the first word of this combination level Dim combination As New System.Text.StringBuilder(wordsArray(wordIndex)) 'And all all the remaining words a this combination level For combinationIndex As Integer = 1 To wordDistance combination.Append(" " & wordsArray(wordIndex + combinationIndex)) Next combinationIndex 'Add this combination to the results returnArray(returnArray.GetUpperBound(0)) = combination.ToString 'Add a new row to the results, ready for the next combination ReDim Preserve returnArray(returnArray.GetUpperBound(0) + 1) Next wordIndex Next wordDistance 'Get rid of the last, blank row. ReDim Preserve returnArray(returnArray.GetUpperBound(0) - 1) 'Return combinations to the calling method. Return returnArray End Function End Class

    Read the article

  • Casting Generic Types

    - by David Rutten
    Public Function CastToT(Of T)(ByVal GenericType(Of Object) data) As GenericType(Of T) Return DirectCast(data, GenericType(Of T)) End Function The above clearly does not work. Is there any way to perform this cast if I know that all objects inside data are in fact of Type T?

    Read the article

  • Raising event in custom control.

    - by SeSSiZ
    Hi all, I'm writing a custom textblock control thats populate hyperlinks and raises event when clicked to hyperlink. I wrote this code but I got stucked. My code is : Imports System.Text.RegularExpressions Public Class CustomTextBlock Inherits TextBlock Public Event Klik As EventHandler(Of EventArgs) Public ReadOnly InlineCollectionProperty As DependencyProperty = DependencyProperty.Register("InlineCollection", GetType(String), GetType(CustomTextBlock), New PropertyMetadata(New PropertyChangedCallback(AddressOf CustomTextBlock.InlineChanged))) Private Shared Sub InlineChanged(ByVal sender As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs) DirectCast(sender, CustomTextBlock).Inlines.Clear() Dim kelimeler = Split(e.NewValue, " ") For i = 0 To kelimeler.Length - 1 If Regex.Match(kelimeler(i), "(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?").Success Then Dim x = New Hyperlink(New Run(kelimeler(i))) x.AddHandler(Hyperlink.ClickEvent, New RoutedEventHandler(AddressOf t_Click)) x.ToolTip = kelimeler(i) x.Tag = kelimeler(i) DirectCast(sender, CustomTextBlock).Inlines.Add(x) If Not i = kelimeler.Length Then DirectCast(sender, CustomTextBlock).Inlines.Add(" ") Else DirectCast(sender, CustomTextBlock).Inlines.Add(kelimeler(i)) If Not i = kelimeler.Length Then DirectCast(sender, CustomTextBlock).Inlines.Add(" ") End If ''//Console.WriteLine(kelime(i).ToString.StartsWith("@")) Next kelimeler = Nothing End Sub Public Property InlineCollection As String Get Return DirectCast(GetValue(InlineCollectionProperty), String) End Get Set(ByVal value As String) SetValue(InlineCollectionProperty, value) End Set End Property Private Shared Sub t_Click(ByVal sender As Hyperlink, ByVal e As System.Windows.RoutedEventArgs) e.Handled = True RaiseEvent Klik(sender, EventArgs.Empty) End Sub End Class This code gives error at RaiseEvent Klik(sender, EventArgs.Empty) Error is : Cannot refer to an instance member of a class from within a shared method or shared member initializer without an expliticit instance of the class. Thanks for your answers, Alper

    Read the article

  • How to display some data differnetly than it is stored.

    - by Ben
    Hello, I seem to have a problem that I can't find a solution for. I have a table that has this format. projectId | departmentId | plan | ETC | month | year | ID But, I need to find a way to take that data and display it like this. Since this is my first time here I can't upload an image, but you can view it here. http://img85.imageshack.us/img85/8253/image004y.png Is this something a gridview can handle, or a repeater, or something else? Thank you. Ben

    Read the article

  • Unable to call WMP's controls.play() function in VisualBasic

    - by A.J.
    I have the following code: http://pastebin.com/EgjbzqA2 which is basically just a stripped down version of http://www.dreamincode.net/forums/topic/57357-mymusic-player/. I want the program to play one file repeatedly, however, this function doesn't work for some reason. The program plays each file once and then stops. Private Sub Player3_PlayStateChange(ByVal NewState As Integer) Handles Player3.PlayStateChange Static Dim PlayAllowed As Boolean = True Select Case CType(NewState, WMPLib.WMPPlayState) Case WMPLib.WMPPlayState.wmppsReady If PlayAllowed Then Player3.controls.play() End If Case WMPLib.WMPPlayState.wmppsMediaEnded ' Start protection (without it next wouldn't play PlayAllowed = False ' Play track Player3.controls.play() ' End Protection PlayAllowed = True updatePlayer() End Select End Sub

    Read the article

  • ASP.NET User Control As FilterParameter

    - by Steven
    When adding WHERE-clause parameters in a DataSource, you can specify an existing form control (textbox, dropdown, etc) by selecting "Source: Control" and then picking the "ControlID" from the next dropdown. Can a user-control be configured to appear in the Controls list?

    Read the article

  • Creating an HTTP-Redirected Virtual Directopry in IIS 6.0 without specifying physical path & WMI/ADS

    - by Steve Johnson
    My question is : Is it possible to create a working IIS 6.0 Virtual Directory with providing Physical Path of the Virtual Directory.? I know that manually, it is not possible via IIS but programmatically such a virtual directory can be created. If an HTTPRedirect is set on that virtual directory but the site physical path is not specified, then will it work? Simply stated, how to create an HTTp-redirected Virtual Directory , directly without specifying any physical path to a folder or network share. Here is my code. Try If Directory.Exists(HomeDirectory) = False And Path.StartsWith("http://") = False Then Directory.CreateDirectory(HomeDirectory) End If Dim website As DirectoryEntry website = New DirectoryEntry("IIS://" & IISServer & "/W3SVC/" & WebsiteId & "/Root") Dim NewVDir As DirectoryEntry = website.Children.Add(VDirName, "IIsWebVirtualDir") If Path.StartsWith("http://") = False Then NewVDir.Properties("Path")(0) = Path NewVDir.Properties("HttpRedirect").Clear() Else NewVDir.Properties("HttpRedirect")(0) = Path End If If ((Perm And Permission.Read) = Permission.Read) Then NewVDir.Properties("AccessRead")(0) = True End If If ((Perm And Permission.Write) = Permission.Write) Then NewVDir.Properties("AccessWrite")(0) = True End If If ((Perm And Permission.DirBrowse) = Permission.DirBrowse) Then NewVDir.Properties("EnableDirBrowsing")(0) = True End If If ((Perm And Permission.CreatetApplication) = Permission.CreatetApplication) Then NewVDir.Invoke("AppCreate", True) End If If ((Perm And Permission.ScriptOnly) = Permission.ScriptOnly) Then NewVDir.Properties("AccessScript")(0) = True End If If ((Perm And Permission.ScriptNExecute) = Permission.ScriptNExecute) Then NewVDir.Properties("AccessExecute")(0) = True End If NewVDir.Properties("AuthAnonymous")(0) = True NewVDir.Properties("AuthNTLM")(0) = True NewVDir.Properties("AnonymousUserName")(0) = AnonUserName NewVDir.Properties("AnonymousUserPass")(0) = AnonPassword NewVDir.Properties("AppFriendlyName")(0) = AppFriendlyName NewVDir.CommitChanges() website.CommitChanges() NewVDir.Close() website.Close() Success = True Catch Err As Exception Throw New Exception("My Custom Exception Here: " & Err.Message) End Try

    Read the article

  • How Can I Choose Appropriate ComboBox Value Based on Select ListView Record? - C#.NET

    - by peace
    Contact Title has a default value which is Sales Person. Anyhow, when a user click Edit on the chosen ListView record, i need Contact Title to have the right value that corresponds to the chosen record. For example, if user clicks edit, the fields on the left side will be filled with values. In this case, i want Contact Title to view the right value. How can i do it? I hope my question is clear enough.

    Read the article

  • Update specific rows in LINQ to SQL result set.

    - by davemackey
    I have a page with a form on it and needs a range of dates. Thus I've placed a number of textboxes on the page into which users can type dates. When the user clicks the save button I want to trigger a LINQ update to the SQL Server...all the rows already exist, so I'm just updating existing data. How can I do this? For example, lets say my table looks like this: Column Names: Description dateValue Column Values: Birthdate 1/1/1990 Anniversary 1/10/1992 Death 1/1/1993 I want to do something like this: hupdate.Description("Birthdate").dateValue = TextBox1.Text hupdate.Description("Anniversary").dateValue = TextBox2.Text hupdate.Description("Death").dateValue = TextBox3.Text hconfig.SubmitChanges() Is there a way to do this with LINQ?

    Read the article

  • Syntax error converting the nvarchar value to a column of data type int.

    - by Phil
    I have 1,2,3,4,5,6,7,8,9 stored as nvarchar inside Level in my db. I then have a dropdownlist with values 1,2,3,4,5,6,7,8,9. When a user makes a selection (i.e 1) (Level.SelectedValue.ToString). This builds an sql query via a param like this: "Select things From MBA_EOI Where level = 1" When I run the select I get the following error: Syntax error converting the nvarchar value '1,2,3,4,5,6,7,8,9' to a column of data type int. I was under the impression that I was dealing with an Nvarchar field and the selected value as string, where does the int conversion come in? p.s I have also tried Level.SelectedItem.ToString

    Read the article

  • How change column names randomly in gridview?

    - by James123
    I am struggling to show different views of gridview with database values. Here is my requirement. Database Table: I need to show one drop downlist with three values 1,2,3. If user selects 3 i Need to show a grid like below Age,AnnualSales and Assortment are names which are coming dynamically from database. High,Medium and Core all are values Here my question is I need to show same attribute names. Like If the name changes from "Assortment" to "Location" I need to show it in different page index . In page index 2 i need to show like below. Please help with solution

    Read the article

  • How do I get a linq to sql group by query into the asp.net mvc view?

    - by Brad Wetli
    Sorry for the newbie question, but I have the following query that groups parking spaces by their garage, but I can't figure out how to iterate the data in the view. I guess I should strongly type the view but am a newbie and having lots of problems figuring this out. Any help would be appreciated. Public Function FindAllSpaces() Implements ISpaceRepository.FindAllSpaces Dim query = _ From s In db.spaces _ Order By s.name Ascending _ Group By s.garageid Into spaces = Group _ Order By garageid Ascending Return query End Function The controller is taking the query object as is and putting it into the viewdata.model and as stated the view is not currently strongly typed as I haven't been able to figure out how to do this. I have run the query successfully in linqpad.

    Read the article

  • Importing an Excel WorkSheet into a Datatable

    - by Nick LaMarca
    I have been asked to create import functionality in my application. I am getting an excel worksheet as input. The worksheet has column headers followed by data. The users want to simply select an xls file from their system, click upload and the tool deletes the table in the database and adds this new data. I thought the best way would be too bring the data into a datatable object and do a foeach for every row in the datatable insert row by row into the db. My question is what can anyone give me code to open an excel file, know what line the data starts on in the file, and import the data into a datable object?

    Read the article

  • visusal studio embedded crystal report keeps prompting database login?

    - by phill
    I'm using visual studio 2005 to develop a form with a combobox passing a value into the parameter of an embedded crystal report. I'm trying to figure out why it keeps prompting me for a database login every single time you try to run the report with a different combobox selection. Here is my code: private Sub Form1_load... Dim ConnName As String Dim ServerName As String Dim DBName As String Dim user As String Dim pass As String Dim gDBA As ADODB.Connection Dim records As ADODB.Recordset Dim datver As ADODB.Recordset Dim query As String '---OPEN THE DATABASE CONNECTIONS gDBA = New ADODB.Connection ': gDBA.CursorLocation = adUseServer 'Added to prevent time out error gDBA.CommandTimeout = 1000 : gDBA.ConnectionTimeout = 1000 gDBA.ConnectionString = "Server=svr13;Database=subscribers;User ID=KViews;Password=Solution;Trusted_Connection=True;" gDBA.Open("Data Source=Kaseya;Initial Catalog=subscribers;User Id=KViews;Password=Solution;", "KViews", "Solution") records = New ADODB.Recordset query = "select distinct groupname from _v_k order by groupname desc" 'records.ActiveConnection = gDBA.ConnectionString records.CursorType = CursorTypeEnum.adOpenForwardOnly records.LockType = LockTypeEnum.adLockReadOnly records.Open(query, gDBA) Do While Not records.EOF ComboBox1.Items.Add(records.Fields("groupname").Value) records.MoveNext() Loop end Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim selected As String selected = ComboBox1.Text Dim cryRpt As New ReportDocument cryRpt.Load("C:\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\CrystalReport1.rpt") cryRpt.SetDatabaseLogon("KViews", "Solutions", "svr13", "subscribers") cryRpt.SetParameterValue("companyname", selected) CrystalReportViewer1.ReportSource = cryRpt CrystalReportViewer1.Refresh() End Sub I looked at this previous posting http://stackoverflow.com/questions/1132314/database-login-prompt-with-crystal-reports but this wasn't very helpful. I couldn't find where a CMC was to disable the prompt. Any ideas? thanks in advance

    Read the article

  • How to Get a Specific Column Value from a DataTable? - C#.NET Winforms

    - by peace
    I have a datatable. I need to fetch a certain column value based on the user input. For example, lets say the datatable has two columns CountryID and CountryName. I need to find CountryID in the datatable based on the user input country name. I could just open a connection with DB and run the query select countryID from Country where countryName = @userinput. Is there anyway i could do this on the datatable. Thanks

    Read the article

  • implement button click in html

    - by vbNewbie
    I have been trying to execute a button event in html page that displays additional content on the web page. I am getting a null reference error when using the getelementbyid and not sure how to change this. Here is the html reference I need to engage: <div class="button" style="float:none;width:180px;margin:20px auto 30px;"><a href="#" id="more" style="width:178px">Show more ?</a></div> </div> and here is my code: Dim wb As New WebBrowser wb.Navigate(fromUrl) While wb.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While Debug.Write(wb.DocumentText) Dim htmlElements As HtmlElementCollection = wb.Document.GetElementsByTagName("<a") If Not wb.Document Is Nothing Then Try If wb.DocumentText.Contains("more") Then If wb.Document.GetElementById("more").GetAttribute("href") Then wb.Document.GetElementById("more").InvokeMember("#") End If End If Catch ex As Exception MessageBox.Show(ex.Message.ToString) End Try End If I appreciate any ideas.

    Read the article

  • .NET - Is there a way to programmatically fill all tables in a strongly-typed dataset?

    - by Mike Loux
    Hello, all! I have a SQL Server database for which I have created a strongly-typed DataSet (using the DataSet Designer in Visual Studio 2008), so all the adapters and select commands and whatnot were created for me by the wizard. It's a small database with largely static data, so I would like to pull the contents of this DB in its entirety into my application at startup, and then grab individual pieces of data as needed using LINQ. Rather than hard-code each adapter Fill call, I would like to see if there is a way to automate this (possibly via Reflection). So, instead of: Dim _ds As New dsTest dsTestTableAdapters.Table1TableAdapter.Fill(_ds.Table1) dsTestTableAdapters.Table2TableAdapter.Fill(_ds.Table2) <etc etc etc> I would prefer to do something like: Dim _ds As New dsTest For Each tableName As String In _ds.Tables Dim adapter as Object = <routine to grab adapter associated with the table> adapter.Fill(tableName) Next Is that even remotely doable? I have done a fair amount of searching, and I wouldn't think this would be an uncommon request, but I must be either asking the wrong question, or I'm just weird to want to do this. I will admit that I usually prefer to use unbound controls and not go with strongly-typed datasets (I prefer to write SQL directly), but my company wants to go this route, so I'm researching it. I think the idea is that as tables are added, we can just refresh the DataSet using the Designer in Visual Studio and not have to make too many underlying DB code changes. Any help at all would be most appreciated. Thanks in advance!

    Read the article

  • How to update non-scalar entity properties in EF 4.0?

    - by Mike
    At first I was using this as an extension method to update my detached entities... Public Sub AttachUpdated(ByVal obj As ObjectContext, ByVal objectDetached As EntityObject) If objectDetached.EntityState = EntityState.Detached Then Dim original As Object = Nothing If obj.TryGetObjectByKey(objectDetached.EntityKey, original) Then obj.ApplyCurrentValues(objectDetached.EntityKey.EntitySetName, objectDetached) Else Throw New ObjectNotFoundException() End If End If End Sub Everything has been working great until I had to update non-scalar properties. Correct me if I am wrong but that is because "ApplyCurrentValues" only supports scalars. To get around this I was just saving the FK_ID field instead of the entity object relation. Now I am faced with a many to many relationship so its not that simple. I would like to do something like this... Dim Resource = RelatedResource.GetByID(item.Value) Condition.RelatedResources.Add(Resource) But when I call SaveChanges the added Resources aren't saved. I started to play around with self-tracking entities (not sure if they will help solve my prob) but it seems they cannot be serialized to ViewState and this is a requirement for me. I guess one solution would be to add the xRef table as an entity and add the fks myself but I would rather it just work how I expect it too. I am open to any suggestions on how to either save my many to many relationships or serialize self-tracking entities (if self-trackingwould even solve my problem). Thanks!

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >