The simplest way would be to create a new .aspx page in your project and copy the HTML into the markup of the .aspx page. Simply renaming the HTML file to aspx wouldn't work because the .aspx file is really like 3 files in one. You have your .aspx, .aspx.[language], and .aspx.designer.[language].

In your code behind, you would bind a DataSet or some other object to a control on your form. In your markup, the statement you gave then uses whatever object you bound to your control to look up the value with a key of Prod_Id.

So, if you bound a DataSet to a ListView and had a template set up for your listview, your statement would show the value in the Prod_Id column as the text for whatever element the statement is used in.

This should work:

label24.Text = String.Format("{0:F2}", a/b)

It would probably be possible, but I would probably rethink why there are database calls inside of the constructor. I would rather split it out into a separate call.

Here's a link to a Microsoft Patterns and Practices article. If it can't answer questions about how to handle database connectivity then I don't know what will:


I don't think variables in XSL are mutable.

If what you're trying to do is put the results of the SELECT statements in a and b into the parameters, then it's not going to work like you think it will. Your best bet is to use a stored procedure. That way you'll be able to use variables in the stored proc to hold the results of the two select statements. Then you just plug them into your insert statement in the same stored procedure.
Otherwise, you'll have to make two DB calls from the code before the insert to retrieve the values and then use those values for your insert.

Have you tried taking renamed "Colour Name" to something like "ColourName"? It might not like the space.

Rather than adding the Temp node from the dataset as a child of the Temp node from doc, you could loop through the children of myNode and add them as children of TempNode.

string xml = "<?xml version=\"1.0\"?><MyTest XMLVersion=\"1.3\" Stamp=\"" + DateTime.Now.ToString() + "\"><Test></Test><OtherNode></OtherNode></MyTest>";
doc.LoadXml(xml);//start the xml
GetTestData(); //gets dataset loads it into an XMLDocument called doc
TempNode = doc.SelectSingleNode("//MyTest");//get the
myNode = m_myTest.SelectSingleNode("//Test");//get the node
myNode = m_MenuOnline.ImportNode(m_MyNode, true);
for(XmlNode child in myNode.ChildNodes)
TempNode.AppendChild(child);//add the node

There's most likely other ways to do this, but it looks like it should solve your problem.

If you've ever expanded the file for a form in the list view in your solution explorer pane, you should see two files below the main Form source file. There should be a [form_name].Designer.cs (or whatever language). Inside that file is where it handles setting all of the properties for your controls. This is also where the event handlers get wired up as mentioned in the other posts.

To answer you questions about the different source files, if you're using Visual Studio, each time you add a new component to your solution (as explained by ddanbe above), it is placed in its own physical code file in your solution's directory. So if you had 10 forms, you would expect to see 10 different source files that each contain one of your forms.

Do you mean you need to start an application from your ASP web application? Are you trying to get it to start on the client's machine? Wouldn't it just start on the server?

When you set the DataSource or load the Items manually, you could just set the SelectedIndex property to 0. That should keep you from getting errors about nothing being selected. I guess whether or not you can do this would have to depend on any Business rules in place or requirements.

Would it be possible for you to just update the value in the database that's bound to the checkbox on the paging event?

Is whether or not the checkbox is checked tied to a field in the database?

Get rid of the surrounding ' for the values in your insert statement.

[code]INSERT INTO DataStatus(CedantID, CompanyType, CompanyName, TypeOfFile, FileName,Reportingperiod) VALUES ('@CedantID', '@CompanyType', '@CompanyName', '@TypeOfFile', '@FullFileName','@ReportingPeriod')[/code]

should probably be

[code]INSERT INTO DataStatus(CedantID, CompanyType, CompanyName, TypeOfFile, FileName,Reportingperiod) VALUES (@CedantID, @CompanyType, @CompanyName, @TypeOfFile, @FullFileName,@ReportingPeriod)[/code]

With Access, I've also had to do something like

[code]INSERT INTO DataStatus(CedantID, CompanyType, CompanyName, TypeOfFile, FileName,Reportingperiod) VALUES ([@CedantID], [@CompanyType], [@CompanyName], [@TypeOfFile], [@FullFileName],[@ReportingPeriod])[/code]

OK...have you tried using the SelectedItem property?

If this is the problem I think it is, I usually fix it by using the Text property of the combo box. It should allow you to get the text of what's in the combo box without the user actually having to select it.

An easy approach would be to separate the values in the array by a comma before putting it into the database as a comma delimited string. Then when you bring it back from the database, just do a split on the comma. I'm sure there's better/more elegant solutions, but that seems like it would work.

You would probably have to play with the count and where the message box is displayed to get this to be exactly what you want, but I think something like this should work.

Public Class Form1

Dim numTries As Short

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    numTries = 0
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If ListBox1.SelectedIndex <> -1 Then
        Dim diagResult As DialogResult = MessageBox.Show("Do you wish to select this item", "Confirm choice", MessageBoxButtons.YesNo)
        If diagResult <> DialogResult.Yes And numTries < 3 Then
            numTries = numTries + 1
        ElseIf diagResult = DialogResult.Yes Or numTries >= 3 Then
            MessageBox.Show("Do whatever")
        End If
    End If
End Sub

End Class

asif786 commented: very good thanks you solved it +1

You could always just use the built in login controls assuming you're using at least .NET 2.0


You could try to use a case statement in the where clause to determine which value to match. You could pass two parameters to the stored procedure. One of the parameters could be used to determine which field from the database to use in the where clause (this is also what would be in the case statement). The other parameter would be the value you want to match.

You could use a Dictionary to create a set of key-value pairs. You could use the name of the food as a string key and the votes as an int value.


If I'm reading this correctly, it sounds like you just want to be able to manipulate the ListView on a Form from another class somewhere in your application. Have you tried making a public instance method in your form class that takes whatever value you want to add to the ListView as a parameter and then calls the Add method of the ListView? (You could do this for the other methods of ListView as well)

If you did that, you should be able to create an instance of the Form and manipulate the list. One thing you need to do, however, is make sure that the instance of the form that you create is the one that is being shown on the screen.

You might want to take a look at jQuery. It makes it really easy to manipulate objects on your page.

Have you tried just reading in the lines and splitting based on the "." and "{"?

Dim streamRead as StreamReader = new StreamReader("xyz.css")
Dim input As String = streamRead.ReadLine()
Dim splitParams as String() = {".", "{"}
Dim cssClass as String
If input.StartsWith(".") Then
cssClass = input.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)(0).Trim()
cssClass = input.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)(1).Trim()
End If

In my limited testing, that seems to give me what you were looking for.

Comatose commented: Excellent +10

If all you have to do is validate each line of text, the System.IO.StreamReader class would be my choice. Just read in each line and do any validation you need to do. Splitting each line by the '\' could make things easier depending on what kind of validation you need to do.

To do what you're trying to do, you're probably going to need to create an instance of the Admin_Calculator class.

How do you open the forms right now? Do you click something on one of the forms that causes the other to open?

What you are describing is easily accomplished with standard .NET code. I don't quite see why you're trying to use JavaScript (...if it's even possibly to do so in this scenario).

The last sentence in your description would lead me to believe it's a separate entity only because a table for Stock would allow a query to be run against that table to get a list of things that might need to be reordered.

How is your application set up?

Is Admin_Calculator the name of the Form or is it an instance of the form you have created? Do you create an instance of the form to show with the .Show() method?