hericles 289 Master Poster Featured Poster

Basically, the position of the sub menus is placed off screen (-999em which is far to the left) and when the top level <li> are hovered over the child <ul> has its margin reset to auto which makes it appear under the menu item. Taking the mouse off the <li> removes the hover effect and its absolute position reverts back to off screen.

hericles 289 Master Poster Featured Poster

You can read this article on how to use ButtonState to adjust the appearance:
http://msdn.microsoft.com/en-us/library/system.windows.forms.buttonstate.aspx

Or, if you are using images for the buttons, you can have a second image that denotes the pressed status.

hericles 289 Master Poster Featured Poster

Well, if it is a web app it needs to be installed on a server like IIS. If you simply moved the files to another computer and expected them to run, that won't work.

Begginnerdev commented: True! Found this out the hard way. +3
hericles 289 Master Poster Featured Poster

Hi,
I'm wondering if a return is needed after your While objReader.Read() loop.
It may be that the compiler considers that to be a branch and is wanting a return to be available after that loop is case the while() can't process. I don't know if that is the problem but it really is the only place I can see that might address the issue.

hericles 289 Master Poster Featured Poster

It sounds like you are trying to enforce presentation into the database which is not the right way to go about it. The database simply holds data, the interface needs to parse the data into the desired form.

hericles 289 Master Poster Featured Poster

Giving a column an alias in the SQL statement is as simple:
SELECT user_id AS User FROM table_name

This will cause your dataset to populated with the data from user_id but the column will be called User in the dataset. You can do this for as many columns as you need in your SQL.

hericles 289 Master Poster Featured Poster

What exactly goes wrong? A screenshot would be nice so we could see what you are referring to.
Without forcing a minimum width on the containers you should just get a scroll bar if your content becomes larger than the screen. Once minimum width is hit everything starts to get shuffled down if there isn't enough space. In your case the moving down of items will happen after the screen size goes below 1000 pixels (i think based on what I see here).

hericles 289 Master Poster Featured Poster

Inability to save the the file to the specified location? Where is it trying to save the file to?
It also shows your code isn't production ready, saving files is something that should have error handling code for just this kind of exception.

hericles 289 Master Poster Featured Poster

Does the page you go back to check to see if a valid session is active?
In the page load part of the page check for whatever session variable shows the user is logged in. If it exists or is set to the correct value continue to load the page. If not then redirect to the home page or login screen. Once you have cleared the session this page won't display even by pushing the back button

hericles 289 Master Poster Featured Poster

Call the Session.Clear() method when the log out code is complete (but before the redirect to the home page). This will clear out all session values regardless of whether the back button is clicked - as long as each page checks for an active session anyway.

hericles 289 Master Poster Featured Poster

I'm assuming you already have the email code because you didn't ask for that.
As I understand it you have the emails stored in a file which allows you to count how many emails you are going to be sending (as each email is unique you send one email per address). The number of emails in the file then becomes the number of emails you are going to send in total.
You are going to run through the email sending code many times so after each iteration (i.e. after calling the send method of the Mail object) increment the current value of the progress bar by one (thereby moving it towards the max value).
This isn't the code you asked for but its late and I'm tired:) It explains the principle behind how to handle the problem though.

hericles 289 Master Poster Featured Poster

If the email being sent is the same for each user why don't you just use cc or bcc to send the email once but to many recipients? Then a progress bar isn't really needed.
If you want to send the emails sequentially (because the emails are different), count how many addresses there are and max this the max value of the progress bar and then, after each individual email has been sent, increase the progress bar by one.

hericles 289 Master Poster Featured Poster

Do you have a site that is currently slow? Or is this for building something new?
Site loading speed depends on a variety of factors. You should make sure all images are no larger on the server than they appear on the page, script files should be optimised and made as small as possible, database operations should only return the bare minimum of required data and be handled efficently.
One thing to be aware of is using the Page.isPosBack function. If the page is being reloaded, rather than loaded for the first, a lot of set up can be skipped (say, loading data into views or dropdowns etc) as it is already there.
If you explain exactly what you need we can probably help more.

narendrajarad commented: solved +0
hericles 289 Master Poster Featured Poster

For your database I would have another linking table that links staff to projects (project_id, staff_id) so that staff members can be tracked by project ID. I know you have client ID, project ID and staff ID in the one table but two tables would be better (clients to projects, projects to staff).
For displaying the data a drop downlist of clients can be selected, after that a second dropdown is populated with their projects and once a project is selected then the staff members can be displayed. that would give you 3 queries against the database as you moved through the client-project-staff tables and it would prevent the user simply getting possibly irrelevant info dumped on screen (staff of a project they're not interested in).

hericles 289 Master Poster Featured Poster

Basically, yes. When your browser starts up it will open the file, read the contents and parse the URLs. You can use basic file IO of .net to do that. Check stream readers and the file object online and you'll find plenty of simple tutorials to guide you.

hericles 289 Master Poster Featured Poster

The directoryInfo Class allows you examine the contents of folders and sub folders. You can read about how to use it here:
http://msdn.microsoft.com/en-us/library/system.io.directoryinfo(v=vs.71).aspx

hericles 289 Master Poster Featured Poster

<script> tags need a closing </script> tag. /> is not enough.

hericles 289 Master Poster Featured Poster

I would have thought this is simply a case of adding code to your exit method (browser shutdown) to save the URLs of all open tabs to either a flat file or small database. On starting the browser read the file and open one tab per entry in the file.

hericles 289 Master Poster Featured Poster

You can code up some simple validation by using javascript's document.getElementById function. Call a method in the on click of your submit button or the onSubmit method of the form and then use the getEelementById to locate each control you want to validate. Do you want to simply check the text boxes have something entered in them or check for bad data at the same time?

A really simple function to check if the user name is filled in would look like this:

function validate{
  var userControl = document.getElementById(txtUser);
  if(userControl.value.length < 1) {
    // handle the error
   return false;
  }
}

Your form will have this included: onSubmit="return validate();" you can then return true to post the form or false to cancel i.e. stay on the same page and handle the errors.

hericles 289 Master Poster Featured Poster

You're going to have to doctor that query script a lot to make it fit your form - the two don't have that much in common. Do you know query? If not it may not be worth your time. Depending on the validation you need to do there are less complex ways of checking the input with javascript.

hericles 289 Master Poster Featured Poster

Sorry, I meant Tuition is of type string in my post above, not int obviously.

hericles 289 Master Poster Featured Poster

No, cast the executeScalar command as it returns an object which you then try to jam in to Tuition. tuition is of type int right? Casting Tuition after it has incorrectly stored the executeScalar won't fix the issue.

hericles 289 Master Poster Featured Poster

You need to cast the returned object from executeScalar. Use the toString() method and it should work OK.

hericles 289 Master Poster Featured Poster

Way more information needed...
What do you mean by edit your program? Are you entering or updating information?
It is most likely your code connecting to the database if the error is related to changing data.
Do you get any error messages?

hericles 289 Master Poster Featured Poster

OK, firstly, does the program need to save the entered data each time or does the user simply enter all past fuels fills at the one time to get the average? The answer to this question determines whether you need to use a file to save the information.

The algorithms are fairly simple. For each fuel fill it is kms done / number of litres of fuel to give kms per litre. Overall distance is the same but including all of the data.

hericles 289 Master Poster Featured Poster

Considering each table has a different range of columns and data types a stored procedure for each is probably required. If you could use the same insert procedure to insert the same data into several tables that begs the question of why you have these others tables in the first place.

hericles 289 Master Poster Featured Poster

before loading the data into the listbox you need to call the .Clear() method on the listbox. This will remove the current data from the listbox. Without that it just appends the new data to what is already in there.

hericles 289 Master Poster Featured Poster

You say you have 5 errors but you don't tell us what they are...
You set the Prompt string within each button function and then place it in each element of the array - I'm not sure why.

Prompt = "Please enter grade scores one at a time";
for (i = 0; i <= Tests1.Length; i++)
            {
                Tests1[i] = Convert.ToInt16(Prompt.ToString);
                Total1 = Total1 + Tests1[i];
                textBox1.Text = Convert.ToString((Total1) / NumTest1);
                if (string.IsNullOrEmpty(textBox1.Text))
                {
                    textBox1.Text = "0";
                }
            }

problem one is this: Tests1 = Convert.ToInt16(Prompt.ToString); - This is should be ToString();
You're trying to convert a string ("Please enter grade scores one at a time") to an integer.
That won't work.

From a readability perspective you've capitalised all of your variables which is normally reserved for classes. Variables conventionally begin with a lowercase letter.

Post up your errors, explain why you need to convert the prompt string to an int and we'll see if we can help you more.

Griff0527 commented: Direct answer that made me think for myself to find one of my many errors, leading me to further investigate the rest. This poster does not give the "easy" answer, but instead expects you to LEARN from your mistakes. +2
hericles 289 Master Poster Featured Poster

Use the app.config (or web.config for a web app). In the <Configuration> section of the app.config add this:

<connectionStrings>
        <add name="name_of_your_connection_string"
            connectionString="your_connection_string"
            providerName="System.Data.SqlClient" />
    </connectionStrings>

There you access it in code via:

Dim conStr As String = ConfigurationManager.ConnectionStrings(name_of_your_connection_string).ConnectionString;
hericles 289 Master Poster Featured Poster

For x As Integer = 1 To dsdg44.Rows.Count - 1
if dsdg44.Rows(x,1).ToString() == teamStr Then
// rank is now equal to dsdg44.Rows(x,0).ToString();
x = dsdg44.Rows.Count; // finish the loop rather than continue
}
Next

hericles 289 Master Poster Featured Poster

Use a loop to run through checking the dataset's 2nd col for the name, when a match is found get that rows first column.

Dim teamStr as String
teamStr = comboBox value
for(int x = 0; x < dsdg44.Rows.Count; x++) {
   if(dsdg44.Rows[x][1].ToString == teamStr) {
       // rank is now equal to dsdg44.Rows[x][0].ToString();
       x = dsdg44.Rows.Count; // finish the loop rather than continue 
   }
}

Thats c# code - I did it again, wrong code for the forum. Anyway, it's easy to switch back to VB. But that will run through the rows in the dataset checking the second column for the specified name and, once found, get the rank from the first column.
Hope that helps,

hericles 289 Master Poster Featured Poster

Just so I'm clear you want to check the database to see if the IsDefault column has a 1 in it anywhere to see if the default has already been set for another name? Only one record in the table can be 1 the rest have to be 0?

hericles 289 Master Poster Featured Poster

Are you saying it calls the CheckBoxValidation twice? Because I can't see where that would happen. you only call the method with the True parameter.
As a point of coding design you replicate code in your IF statment that you don't need to. Apart from UpdateCMD inside of InsertCMD the two sections are the same. It would be better to do this:

SQLConn.Open()
trns = SQLConn.BeginTransaction
string messageStr
If bNewData Then
   InsertCMD()
   messageStr = "Record Saved Successfully"
Else 
   UpdateCMD()
   messageStr = "Record Updated Successfully"
End If
trns.Commit()
SQLConn.Close()
GetData()
bNewData = False
bEditData = False
Count()
MessageBox.Show(messageStr, "Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
EnableControlsLoadMode(True)

Also your try block is quite long and you use the beginTransaction and commit immediately on either side of the insert or update commands. The problem here is that you still have potential causes of an exception being thrown in your try/catch block - namely GetData() and Count() - which would then hopelessly call the rollback() command. You've already committed by that point so its too late to roll back.

hericles 289 Master Poster Featured Poster

The .Net framework can use access database files (.mdb) without access being stalled so that are a possible solution. You might have to check if Jet is still installed on modern versions of Windows as I don't know if it is (windows 7 & 8).

Otherwise you can set up sql server as a dependency of your project so its installation is part of your installer. A good tutorial on creating msi's will include how to do that.

hericles 289 Master Poster Featured Poster

So you have used a dataAdapter to fill a dataTable. The items in the dataTable can be accessed using notation like this:

string sample = dt.Rows[0][1].ToString();

This is accessing the second element in the first row of the dataTable and storing it in a string variable. You can use column names rather than indexes if you prefer.

hericles 289 Master Poster Featured Poster

So, I guess you also have a textbox where the name is entered and a button to submit the search. In the button click function take the name entered into the textbox and make that part of your SQL query (SELECT patientName FROM tableName WHERE patientName LIKE '?name' - where ?name is the parameter).

Then return the rows from the database in a dataTable and bind the datatable to your combobox using the dataSource and dataBind functions.

hericles 289 Master Poster Featured Poster

Hi,
What database to use depends on how much data you expect to store (although that is also not that important unless the amount of data is expected to be HUGE). You could save your data in text or XML if you wanted but there would be a reasonable performance hit as the files got longer.
SQL or MySQL should be perfectly adequate for your needs.

To save the data storage problem you could simply request the next question from the database as one is solved, then you're only holding one question in memory at a time. An obvious issue here would be if you wanted the questions to be in random order - you'd need to handle that somehow.

Or you could just extract all of the questions for the quiz and store them in a dataTable in memory (but out of the database) and access them in turn or randomly. This could potentially clog your server depending on the number of questions, concurrent number of users, etc.

I hope that helps,

hericles 289 Master Poster Featured Poster

There are two ways of doing it. You can add the variable to a session variable:

Session["variable"] = some variable

and then retrieve it in the page load of the next page.

variable = Session["variable"].ToString();

Or you can use POST or GET to include it in the request to the new page and then use the query string to extract it. Both are easy to implement.

hericles 289 Master Poster Featured Poster

Yep, SELECT DISTINCT will provide you with a list of the unique values in the table. Records that are in the table twice or more will only be in the resulting dataset once.

hericles 289 Master Poster Featured Poster

Oddly enough you have the correct the code to make the lblWarning not visible, yet for the list you have coded lstCity.Visible = Not lstCity.Visible.
try:

lstCity.Visible = false

You never seem to sent toZone, only fromZone, so your check to see if they match can never match. And you have an error in your code:

If (fromZone = toZone) Then
ticketPrice = 250
Else
ticketPrice = 400
End If

You need to use == to check for equality. fromZone = toZone simply sets fromZone to be equal to toZone. It doesn't check if they are the same, it makes them the same.

hericles 289 Master Poster Featured Poster

Mark as solved:)

hericles 289 Master Poster Featured Poster

Check your other post that relates to this exact same question. I put an example SQL check constraint there.

hericles 289 Master Poster Featured Poster

You use the validators at the client end, either the win form or the web page.
Say you have a textbox that the user enters a number in. You apply a RangeValidator to the textbox which, when the button to insert the data is clicked, checks the value in the textbox is within the specified range. If not,processing stops.
If you want to do the validation in the database you can set up check constraints on the column. Here is a sample table definition that restricts a column to positive numbers:

CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
CHECK (P_Id>0)
)

Hope that helps,

hericles 289 Master Poster Featured Poster

I can't actually see where you use the entered hours of labour. You use the constant version here:

SubTotalDecimal = PartsDecimal + HOURS_OF_LABOR_Decimal

And later you have this:

ElseIf HOURS_OF_LABOR_Decimal > 0 Then

The whole idea of a constant is just that - it never changes. So having a test to see if it is over a certain value is really quite pointless.

And then you have this:

HoursOfLaborTextBox.Text = HOURS_OF_LABOR_Decimal.ToString("C")

You never seem to use the HoursofLaborDecimal you set up, except to increment by one during the pointless constant check I pointed out above. I think you confused yourself by having a constant and a variable so closely named.

hericles 289 Master Poster Featured Poster

negative values I believe. He's used the electrical shorthand.
In your front end add a RangeValidator to the control where the numbers are entered and set the minimum value to 0.

hericles 289 Master Poster Featured Poster

In text the power sign is normally given by the ^ character (above your 6 on the keyboard. E.g. 10^2 = 100.
Using a word processor the 2 would generally be turned into superscript which places it above the other characters and smaller.
In HTML you can use the <sup></sup> tag or use a CSS class.

Is that what you are after?

hericles 289 Master Poster Featured Poster

Are you referring to using CSS to style the location of the button?

hericles 289 Master Poster Featured Poster

Not without seeing some code...

hericles 289 Master Poster Featured Poster

I think that is because all you are doing is subtracting 32 of KeyAscii. You're not doing anything with KeyAscii after that, remember it is just a variable you defined. You actually need to take that converted character and append it to the characters in the text box.

Rather, if your exclusion code is working and the text box only accepts letters and numbers, why don't you just use toUpper() to convert the string to uppercase?

hericles 289 Master Poster Featured Poster

He has left out the initial declaration of the command object and the data reader. Add this:

Dim cmd As New SqlCommand()
cmd = New SqlCommand(str_query, Conn)
Dim dr As New DataReader()
dr = cmd.ExecuteReader