Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Dominick Marciano

@Dominick Marciano
About
Posts
175
Topics
93
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Two Issues with Custom Control with ASP.NET Site
    D Dominick Marciano

    Good Afternoon, I am working on a project where I will need a custom control added to a site. Since I have never worked with them previously, I decided to try and make a very basic control and a test site so I can learn how to do everything properly. For instructions, I was using the steps outlined on Microsoft's website here. Therefore I created a solution with two projects - Custom Control Assembly and Custom Control Test Site, both of which are using the 4.7 version of the .NET Framework. For the Custom Control Assembly, the Assembly name is CustomControlAssembly and the Default namespace is CustomControlNamepsace. There is one file in the project called CustomControl which inherits from

    System.Web.UI.Control

    . This project built without any errors and I copied the CustomControlAssembly.dll to the /Custom Control Test/Custom Control Test Site/bin folder as instructed on the Microsoft page listed above. The Custom Control Test Site is a web forms site. On the Default.aspx page I added the following directive right underneath the

    <%@ Page %>

    directive:

    <%@ Register TagPrefix="Custom" Namespace="CustomControlNamespace" Assembly="CustomControlAssembly" %>

    In the page, I am able to add the following tag and IntelliSense correctly finds it:

    However, if I try to add an ID properties (in order to name it like I do with all ASP.NET controls), like the following:

    I get the following error message: CS0400 - The type or namespace name 'CustomControlNamespace' could not be found in the global namespace (are you missing an assembly reference?) If I take the ID="CustomControl1" out of the tag, then the site will build fine again. However, when I run the site, the custom control does not show anything on the site. I tried updating the CustomControl to inherit from

    System.Web.UI.UserControl

    instead of

    System.Web.UI.Control

    but it still doesn't display on the Default.aspx page. The following is the markup of the CustomControl.ascx file:

    ASP.NET asp-net help csharp html dotnet

  • Debugging a Web API Project in Visual Studio 2017
    D Dominick Marciano

    I currently have a solution which contains two projects: an ASP.NET site and a Web API project. On the site, I have a page that is meant to call the API using the POST method at address http://localhost:52855/api/v1/GetPrices asynchronously (e.g. response = await base.SendAsync(request, cancellationToken where "base" is a DelegatingHandler). Part of the data that is posted is an API key along with a signature to ensure the user is authorized. However, nothing happens; the Chrome tab just shows the loading symbol continuously. But, if I use Fiddler and make a POST request to the same address (http://localhost:52855/api/v1/GetPrices), but without the API/signature information, I get back the correct response - a 401 Unauthorized and a "WWW-Authenticate: amx" header (where "amx" is the authentication scheme I'm using for testing. If I include the authorization header in Fiddler then I get a 500 Internal Server Error My biggest question is how can I debug the Web API project in Visual Studio 2017 Enterprise edition? I have breakpoints set on all the methods (e.g. the Post method in my GetPricesController : ApiController as well as my HMACAuthenticationAttribute which implements the IAuthenticationFilter). I feel that if I can at least start seeing what's going on when I make the requests with Fiddler, that I may be able to figure out the web app from there. I'm supposed to be doing a demo on this Web API project tomorrow early afternoon and I've been working for the back 11 hours on finishing this up but I'm completely stalled now and have no idea where to go from here. Any help/guidance would be so greatly appreciated. Thank you. P.S. I was using this article http://bitoftech.net/2014/12/15/secure-asp-net-web-api-using-api-key-authentication-hmac-authentication/ to implement the API key validation.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    ASP.NET question csharp security help asp-net

  • How to trace an unhandled exception in C++ using Visual Studio 2017
    D Dominick Marciano

    I am currently working on fixing a project for a client. A little information about the project first: 1. Originally developed in Visual Studio 2012 using xp_v110 build tools 2. Multiple projects in the solution 3. Currently updating/debugging in Visual Studio 2017 using VS 2015/xp_v140 build tools 4. Working on Windows 10 The application will run in debug mode, however if I just leave the application after starting the debug session (i.e. not opening/clicking on the application to open it as it starts minimized in the tray), the application crashes after 1-2 minutes. Unfortunately the IDE is showing that the crash is taking place in chkstk.asm with the following message: Exception thrown at 0x0064EDF9 in <>: 0xC00000FD: Stack overflow (parameters 0x00000000, 0x000A2000). I have updated the exception settings to break when all C++ Exceptions are thrown, checked the box that says "Break when this exception type is thrown", and wrapped the initial method that runs in a try block, however I can never catch the error in the C++ code; it always occurs in the chkstk.asm file. Any suggestions on how I can find out where in the C++ code the exception is occurring. Like I said, this is an update for a client and the original programmer is not available, and they never commented their code, so it is difficult enough trying to go through all this. Any help/suggestions would be greatly appreciated. Thanks in advance.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Managed C++/CLI visual-studio debugging help csharp c++

  • Client/Server Application - Locating Server on Network
    D Dominick Marciano

    I am currently writing a business application which is a collaborative tools (e.g. messaging, file sharing, reminders, etc.) which uses a client/server model. One thing I'm currently stuck on is how the client application can locate the server without requiring each user to enter the IP address in their own application. From research I've done, it appears that there are two ways this can be accomplished. 1. I can require that the system admin (who installs the server application) to create an A record for the server and then create an SRV record which would list the port and the hostname (from the A record). However this would require the network to have a DNS server. 2. I can use IP multicasting. On a predefined port, the server can send out a message at regular intervals which contains its IP address and the port to connect on. When the client application starts up, and during login, the client application can listen for this message to determine where the server is located. If the second option is viable, any suggestion on how often the multicast message should be sent out? It should be often enough that by the time the client application has finished loading, and the user has begun the login process, it has already identified the local server. However, I'm worried about sending it too often and causing network congestion. I am leaning towards option two as it doesn't require any DNS records to be updated and seems to be easier for whoever installs the server application. I was wondering if anyone else has had to do something similar and had any suggestions on either of these two methods, or any other method that may work better. Please note that I am using .NET 4.6, server application is a windows forms application, and the client application is being designed with WPF; WCF is not being used for this project. Any comments or suggestions would be greatly appreciated. Thank you in advance for any help in this matter. -Dominick

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic csharp sysadmin help wpf winforms

  • GA/GEP Mutation Rates
    D Dominick Marciano

    I wasn't sure if this forum was the best one for this question, so I apologize in advance if it isn't. I'm currently learned Gene Expression Programming and I'm a little unclear as to how the mutation rate is applied to a population. I've looked at source code from different implementations and I've seen it used different ways and would like to know if there is actually a proper way to implement it or if it can be implement at the programmers discretion. As an example, say there are 10 chromosomes, each with 2 genes, and each gene has 10 nodes and the mutation rate (mr) is 0.1. I've seen code that mutates nodes implemented in these way:

    1. Loop through each chromosome and generate a random number (rn) between 0 - 1 on each loop. If the rn <= mr then select the gene for mutation. Then loop through every node of the chromosome, ignoring gene boundaries (so in this example there are 20 nodes = 10 nodes/gene * 2 genes) and generate another rn and if the rn <= mr, mutate the node.
    2. Loop through each chromosome and generate a random number (rn) between 0 - 1 on each loop. If the rn <= mr then select the gene for mutation. Then loop through each gene, again generating a rn on each loop, and if the rn <= mr select the gene for mutation, otherwise continue the loop. If the gene is selected for mutation, loop through each node of the selected gene (10 nodes since there are 10 nodes/gene), generating a rn on each loop and mutate the selected node if rn <= mr.
    3. Randomly select 10% of the nodes in the entire populate (in this case 20 nodes since there are 200 nodes = 10 chromosomes * 2 genes/chromosome * 10 nodes/gene).
    4. Randomly select 10% of the chromosomes (in this case 1 chromosome) and then select the nodes for mutation following the same procedure as Item 1 or Item 2 above, starting from the second loop.

    I believe that either Item 1 or Item 2 would be the correct way to apply the mutation operator, but I haven't been able to find a definitive answer either through searches on Google/CP or in the book I have been reading. One other thing that is mentioned in the book I am reading, but isn't explained in detail is the following: there is a population of 10 chromosomes, each with 1 gene, and a total length of 14 nodes. The book states that the mutation rate should be equivalent to two one-point mutations per chromosome, which in this case (because the chromosome's length is 14) should be 0.143. How was a mr of 0.143 derived from the chromosome length of 14? This is

    Algorithms question tutorial lounge learning

  • Script Resource Mappings Not Loading From CDN
    D Dominick Marciano

    I am using a script manager in one of my master pages in order to load several libraries: jQuery, jQuery UI, and Moment. I set up the mappings in the MapJsLibraries method that is called by the Application_Start method in Global.asax:

    Private Sub MapJsLibraries()
        With ScriptManager.ScriptResourceMapping
    
            .AddDefinition("jQuery", Nothing, New ScriptResourceDefinition With {.Path = "~/scripts/jquery-2.1.3.min.js",
                                                                        .DebugPath = "~/scripts/jquery-2.1.3.js",
                                                                        .CdnPath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js",
                                                                        .CdnDebugPath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js",
                                                                        .CdnSupportsSecureConnection = True})
            .AddDefinition("jQueryUI", Nothing, New ScriptResourceDefinition With {.Path = "~/scripts/jquery-ui-1.11.3.min.js",
                                                                         .DebugPath = "~/scripts/jquery-ui-1.11.3.js",
                                                                         .CdnPath = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js",
                                                                         .CdnDebugPath = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js",
                                                                         .CdnSupportsSecureConnection = True})
            .AddDefinition("Moment", Nothing, New ScriptResourceDefinition With {.Path = "~/scripts/moment-2.9.0.min.js",
                                                                         .DebugPath = "~/scripts/moment-2.9.0.js",
                                                                         .CdnPath = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js",
                                                                         .CdnDebugPath = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js",
                                                                         .CdnSupportsSecureConnection = True})
        End With
    End Sub
    

    In my master page I have the script manager control:

    ASP.NET javascript com design hosting tools

  • Prevent Validation From Normal HTML Controls
    D Dominick Marciano

    I'm currently designing a page using ASP.NET and JQuery which is very similar to an order form. The page has two ASP.NET Panels; the first one contains ASP.NET controls for some general information. These controls all have validators associated with them, all part of the validation group "vgRequest", along with a validation summary control which is also part of the vgRequest group. The second Panel contains only HTML text boxes () and two buttons (). When one of the buttons is clicked, it is supposed to call a JQuery function, however the HTML button is causes the ASP.NET validators to run. I do not want this to happen as at the very end of the page there is another ASP.NET button which should cause the validation to run. I have tried setting the EnableClientScript property on the validation summary control to False but this didn't help. I've also tried searching on Google but everything I've come across talks about using controls. Is there anyway to prevent normal HTML controls from causes the ASP.NET validators to run? I know I could use and set the CausesValidation property to False, but I don't know if this is an option. I'm using the Knockout library and the button I currently have is Add Line</button> but I haven't figured out a way to add the data-bind='click: addLine' to an ASP.NET button (I have tried OnClickClient='addLine' but this didn't work either. Any suggestions or information that can help resolve this issue would be greatly appreciated. Thank You

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    ASP.NET help csharp javascript html asp-net

  • Code only working with break points
    D Dominick Marciano

    I have a very strange issue that I have been unable to resolve. I have a window that is opened on a new thread that contains a custom control box with the min, max, and close buttons as ellipses, with handlers attached:

    As an example of the problem, here is the code for the minimize button's MouseLeftButtonDown and MouseLeftButtonUp handlers:

    Private Sub btnMinimize_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
    btnMinimize.Fill = CType(Me.Resources("Min_pr"), ImageBrush)
    End Sub

    Private Sub btnMinimize_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
    btnMinimize.Fill = CType(Me.Resources("Min_inact")

    WPF help tutorial

  • Multithreaded Windows with Data Binding
    D Dominick Marciano

    I am working on an application that will need to open multiple windows, each on a separate thread. I have each on a different thread because each window represents a "Ticket" which will need to get data from a server, update a server, as well as other stuff and when all were running on a single thread some of the ticket windows were lagging. I am able to create the ticket windows and pass arguments, however as soon as I start trying to update properties on the window I get exceptions. Currently each window that needs to be created is created using this method:

    Private Shared Sub CreateNewWindow(Of T As Window)(ByVal newThread As Boolean, ByVal onOpened As Action(Of T), ByVal ParamArray args() As Object)
    Dim activateWindow As Action = Sub()
    Dim window As T = DirectCast(Activator.CreateInstance(GetType(T), args), T)
    AddHandler window.Closed, Sub(s, e)
    window.Dispatcher.BeginInvokeShutdown(DispatcherPriority.Background)
    End Sub
    window.Show()
    If onOpened IsNot Nothing Then
    onOpened(window)
    End If
    End Sub
    If newThread Then
    Dim newWindowThread As New Thread(New ThreadStart(Sub()
    SynchronizationContext.SetSynchronizationContext(New DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher))
    activateWindow()
    System.Windows.Threading.Dispatcher.Run()
    End Sub))
    newWindowThread.SetApartmentState(ApartmentState.STA)
    newWindowThread.IsBackground = True
    newWindowThread.Start()
    Else
    activateWindow()
    End If
    End Sub

    And the window's constructor is:

    Public Sub New(properties As WindowProperties)
    InitializeComponent()
    _ticket = properties.Ticket
    Me.Top = properties.Top
    SetupWindow()
    End Sub

    And the SetupWindow

    WPF wpf wcf sysadmin announcement

  • Loop in Dispatch.Invoke Not Updating UI
    D Dominick Marciano

    In my application I have a window with a custom look and title bar. The XAML for my window is:

    I would like to be able to blink the title bar under some circumstances from a second thread using a loop. For testing purposes I am using the button to start the thread to blink the title bar between green and red with a half-second delay in between the changes. In the button's click event I create a thread and start it:

    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Try
    Dim thread As New Thread(AddressOf ChangeTitleBarColor)
    thread.Start()
    Catch ex As Exception
    Dim m As String = ex.Message
    End Try
    End Sub

    I've only used the Dispatcher a couple of times, so to initially test the ChagneTitleBarColor method and ensure I was using the Dispatch correct I used the following code:

    Private Sub ChangeTitleBarColor()
        Try
            titlebar.Dispatcher.Invoke(Threading.DispatcherPriority.Render, Sub()
                                                                                titlebar.Background =
    
    WPF wpf design testing beta-testing

  • Handling Unsigned Integers for Compatability
    D Dominick Marciano

    I am currently working on an Android application (my first) and I am trying to add the licensing code that I use for all my other applications. The issue I have run into is that all my other programs were written in VB.NET and there is a hashing function that uses UInteger. I recently discovered that Java doesn't have unsigned integers so my hash function in Android is failing to give the same results as my .NET equivalent. Unfortunately I've used this code in too many projects to go change the hashing routine in all my other applications. The issue is occurring in this piece of code:

    for(byte b : uniBytes){
    hash += b;
    hash += (hash << 10); <--This returns negative numbers
    hash ^= (hash >>> 6);
    }

    I tried implementing some logic so that after every operation the code would check if the hash variable was negative and if so convert it to a long such as long lngHash = 0xFFFFFFFFL & hash;, and I understand why it must be converted to a long. However, after a few more operations the hash would start to become incorrect again. I am assuming this is because if the number reaches a range that can fit into an integer, I must convert the number back to an integer in the same way when it grew I needed to convert it to an long. I have even tried some open source libraries but they didn't support the shift operators. Any suggestions or insights into this? Am I at least on the right track with having to convert the hash back and forth between an integer and long as need? Any help or guidance of how to get this method to work is greatly appreciated. Thanks.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Java help csharp java android

  • DataAnnotations - Multiple Acceptable Values
    D Dominick Marciano

    I was looking into using data annotations to help validation on one of my classes. However, in my class there is a property called CommandFamily which is a Byte. This property must have a value of 0x01 - 0x07 or 0xFF. I have already applied the Required attribute and was looking into using the Range. However the Range attribute can only accept a minimum and maximum value and you cannot apply more then one Range attribute. I checked on MSDN and I don't see any other attribute that will allow you to apply a list of values. I would really like to avoid having to change the acceptable values for the CommandFamily property if possible. Is there any way data annotation attribute, or combination, that will allow me to specify a range of acceptable values, instead of just a single range? Thanks in advance for any assistance or guidance on this.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic help question

  • Get Attributes of External Assemblies
    D Dominick Marciano

    Wow...how did I miss that one?! I guess that is what I get for working on it till 3AM. I will take a look at that tonight when I get home. Thanks!

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic question help tutorial announcement

  • Get Attributes of External Assemblies
    D Dominick Marciano

    I'm trying to write a method that can take the path to any valid assembly and then analyze its attributes, such as title, company, and trademark, but especially custom attributes. Although I will want to get standard assembly attributes, my main purpose for this application is to get information from a custom attribute I created in another project that I add to most of my assemblies. I have already have a method that take an assembly as a parameter and can pull the information I need. I also have a method that displays an open file dialog window where a user can select a file and then the method determines if it is a valid assembly. What I can't figure out is how to take the path to the assembly file, create an assembly object from it, and then pass it to the method that get the attributes. He is a VERY stripped down version of the AssemblyAttributes class just to demonstrator the constructor that take an Assembly object. This class is not a concern; I have already tested all the code within this class by using the GetExecutingAssembly method and all the code worked fine:

    Public Class AssemblyAttributes

    Private _assembly as Assembly

    Public Readonly Property Copyright as string
    Get
    Return GetCopyrightString
    End Get
    End Property

    Public Sub New(assembly As Assembly)
    _assembly = assembly
    End Sub

    End Class

    And then I have my method, that gets called from a button's click event, which takes the path to an assembly (the stream writer is used later in code that is not shown to output the attribute information). This is the method where I have having trouble:

    Private Sub GetAssemblyAttributes(assemblyName As String, ByRef sw As StreamWriter)

    Dim currentAssembly As Assembly

    Dim assemblyAttributes As New AssemblyAttributes(currentAssembly)
    Dim copyright As String = assemblyAttributes.Copyright

    End Sub

    How can I using assemblyName to create the currentAssembly object? I have tried:

    Dim currentAssembly As Assembly = Assembly.Load(name)

    And got a FileLoadException and got the error message: Could not load file or assembly 'C:\\[PathToAssembly]\\[AssemblyTryingToAnalyze].dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) Next I tried:

    Dim currentAssembly As Assembly = Assembly.LoadFile(name)

    An

    Visual Basic question help tutorial announcement

  • Start another process as admin
    D Dominick Marciano

    We are aware of the possible security risk but my company considered it extremely low. My company wants an application that is a single file, does not require an installation, is able to gather some basic computer information, as well as install two other programs. One of those two programs need admin privileges to install. I have tried using the Process.StartInfo class with username and password but I still get an exception about the installation of one of the programs needing elevated privileges. The chances of anyone being able to disassemble the assembly to get the admin info is very remote and even if they did get it they couldn't really do any harm with it. The computers aren't on a domain; we create the account on the computers so that way the users can't just install any software on their computers or just do any updates they want. Plus there isn't any server at their site that they would get access to should they somehow get the credentials, or any kind of shared resources (except the DropBox admin account which uses different credentials). In addition, once the program does what it is supposed to do, the file deletes all traces of the program. I know this isn't the best way to go about it, but for what my company is looking for (a single file that is fully automated, thereby not needing any IT intervention to input the credentials) this is the only way I could think of doing it. As an extra layer of precaution I did implement a very simple encryption algorithm so if somehow they did disassemble the file they wouldn't just see a plaintext password.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic help tutorial csharp dotnet sysadmin

  • Start another process as admin
    D Dominick Marciano

    My program doesn't need to be installed. It is a single executable that I'm placing the client's DropBox folder and then sending a link to everyone. This way they can just click the link and the program will run without requiring any user interaction.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic help tutorial csharp dotnet sysadmin

  • Start another process as admin
    D Dominick Marciano

    I'm creating a software package that we are deploying to multiple employees at one of our client's sites. This software is designed to gather system information (OS, 32/64-bit, machine name, etc.) and also check whether N-able and Lync Basic 2013 is installed, and install them if necessary. Currently both the N-able and Lync installation packages are embedded within my assembly. If the user is missing either program, the file will be extracted and ran silently without any user input. The issue I'm running into is that the N-able installation requires admin privileges. All the computers have the same admin account (we set it up that way; they don't have a central server/domain) and I'm trying to have the N-able run under that account so that way the user is prompted with any messages. From everything I've been reading it seems that I have to create some kind of intermediate program that my program runs, which then can run the N-able silent installation using the admin account. However I haven't been able to find any good tutorials/step-by-step guides on how to do this? Anybody have any links to guides on how I can do this. I just need to know how I can start another process using the credentials of an admin account that I already know; the users don't know these credentials so I can't have them type them in. I have tried using Process.Start with various settings, CreateProcessAsUser, CreateProcessWithLogonW, etc. but they all give me errors such as "This operation requires elevated permissions, "A required privilige is not held by the client", etc. It doesn't matter if I do it through the .NET Framework, P/Invoke, or a separate library, as long as the guide instructs me how I can use it from my assembly it's good. Any help that you can provide will be greatly appreciated...I'm supposed to have this finished within the next day or two. Thank you a lot in advance.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    Visual Basic help tutorial csharp dotnet sysadmin

  • Prefixing ListBoxItem index in DataTemplate
    D Dominick Marciano

    I am not creating ListViewItems and inserting those. I'm creating new instances of the Steps class and inserting those. The Steps class as a property called Text which is what I want displayed in the list box which is why I'm binding to (). However I wanted the index number prefixed to it, so I was hoping there was some XAML multi-binding expression to add it, without creating an ObservableCollection. However, if I'm understanding you correctly your saying that I should binding the list box to an ObservableCollection, and when a user clicks btnAddEntry the new Steps instance is added to the ObservableCollection, and use the MultiConverter to present the data for the XAML multi-binding expression?

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    WPF wpf help database wcf tutorial

  • Prefixing ListBoxItem index in DataTemplate
    D Dominick Marciano

    I have a class called Steps and one of the properties is called Text (but it has several others as well). When a user types text in a text box (called txtText) and click the button (called btnAddEntry), and new Steps class is created and added to the list box. My issue is how to format the entries in the list box. I would like the list box to show the value of the Text property of the Step just added, but I would also like the index of the item just added to be prefixed to the text. The XAML for me list box is:

    <Label Content="{Binding Path=Text}" />

    So if I type the entries "First Item", "Second Item", "Third Item" into txtText and click the btnAddEntry the list box will show

    First Item
    Second Item
    Third Item

    However I want the list box to show:

    1. First Item
    2. Second Item
    3. Third Item

    I've attempted this by modifying the ListBox.ItemTemplate in various ways, but just can't seem to figure it out. I have tried things like the following:

    <Label Content="{Binding Path=Index}" />
    <Label Content="{Binding Path=Text}" />

    As well as using RelativeSource to Self, but I can never get the list box item to prefix it's index within the list box. I really want this down in XAML because there are buttons to move items up and down the list box after they are added (so the user can reorder items instead of deleting them and re-entering them) and if I using bindings in the item template, these numbers should auto-update. Any help with this will is greatly appreciated. Thanks in advance for any help.

    A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.

    WPF wpf help database wcf tutorial

  • MySql Connection String 'localhost' not working
    D Dominick Marciano

    @Eddy: From the command prompt I typed "ping localhost" and the response was "Reply from ::1: time=1ms" so it is recognizing localhost, although I expected it to say "127.0.0.1" instead of "::1: which if I'm not mistaken is IPv6. Could this be the source of the issue? @jschell: In response to item 2, how can I check this? I'm using MySQL Community Edition and I do all my set up/maintenance through MySQL WorkBench. Can you provide some guidance on this? @SarveshShukla: In my original post I mentioned I already checked this and there was already an entry for 127.0.01 to localhost. Thank you so far for all the help and suggestions. It is greatly appreciated. P.S. I forgot to mention that although I'm using MySQL Workbench and all my database design was originally pure MySQL I did change it to MariaDB and also use HeidiSQL for when I design my tables and whatnot. I checked and MySQL Workbench still connects to the tables and I can modify/create/update table schemas and data in either HeidiSQL or MySQL Workbench and the other program will see the appropriate changes. But as far as the actually database server settings I still use MySQL Workbench.

    Database database mysql sysadmin help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups