Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I might point out, from a quick browse of your recent posts that the reason for the most recent down vote was most likely as a result of posting in a solved thread with a new question.

Generally, if you have a new and unique question it gets a new thread, if your question is "solved" by someone else's post's resolution then it gets no thread at all. Resurrecting someone else's solved thread to start your own question is generally looked down upon.

As mentioned above, however, if you didn't get reputation loss from it, it really doesn't affect you other than as a reminder that you perhaps didn't do something in the accepted way, which is kind of the point of the voting system around here last I checked :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I threw this together to illustrate what I was trying to convey with my pseudocode before. Please note that the reason I used .ToLower() on my inputs is to ensure that all characters being compared are in the same case as upper and lower case characters count as different when doing a straight comparison. In order to get the same result with the second compared to first (instead of just first compared to second) simply add another pair of loops with the reverse order for the comparison and you're set.

static void Main(string[] args)
        {
            string unmatched = ""; // Define output string
            string word1 = Console.ReadLine().ToLower(); // Read input of word 1
            string word2 = Console.ReadLine().ToLower(); // Read input of word 2
            char[] word1charArray = word1.ToCharArray(); // Convert word 1 into character array
            char[] word2charArray = word2.ToCharArray(); // Convert word 2 into character array
            bool match = false; // Matched character condition set

            for (int a = 0; a < word1charArray.Length; a++) // Iterate through characters in word 1 array
            {
                for (int b = 0; b < word2charArray.Length; b++) // Iterate through characters in word 2 array
                {
                    if (word1charArray[a] == word2charArray[b]) // Check if current character in word 1 array matches current character in word 2 array and set flag if matched
                    {
                        match = true;
                    }
                }
                if (match != true) // If no match through all characters in word 2 with current character in word 1 add word 1 character to output string
                { …
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

It's not that it cannot be done without stored procedures, it's more that it's not as secure to do so without stored procedures.

When dealing with login procedures it's safest to keep user and password variables from being passed around from place to place.

Using stored procedures keeps the entire process on the SQL server with no data being passed other than confirmation of valid or invalid results.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

reemhatim;

While I'm not about to go ahead and do your code for you I will do what I can to put you in the right direction.

Using the following method you should be able to determine the letters that are not repeated between the two.

  1. Input user selected words as character arrays
  2. Loop all characters in array 1
  3. ForEach character in array 1 check each character in array 2 for equality
  4. if character from array 1 matches 0 characters in array 2 then append to string variable for output
  5. as additional step you can loop all characters in array 2 and compare them to array 1 as well so that you get all characters from 2nd word that don't match first word as well
  6. output string with unmatched characters

Based on your original example "Computer Program" output for option 1 would be "Cute" output for option 2 would be "CutePga"

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well there's an option where you can pull the UN/PW from the DB based on a query which checks against the UN only and confirm the PW against the associated PW for the UN you pulled.

In doing this, even if the PW is incorrect you still verify that the UN exists.

However, if you're not careful with the coding then you've now pulled the PW into the code-behind as a variable which is potentially accessible.

What you could do is have both functions as stored procedures on the SQL server however. Benefit of this is that the checks are all done on the SQL server and do not ever come across to the code-behind.

Basically... SP#1 = check if UN exists in SB
if SP#1 returns records == 1 then execute SP#2
SP#2 check if PW matches record for associated UN
if SP#2 returns records == 1 then execute login
else execute failedLogin

Dunno if that makes sense but hope it helps.

AngelicOne commented: good logic +1
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

AngelicOne;

For shame... I thought I'd trained you better in the art of posting questions :twisted:

No code examples, no real details of any sort. You're breakin' my heart here man!

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I find myself curious what language(s) if any you used prior to learning C#.

The reason I ask this is because I notice that you don't use any braces with your if/else statements. While they 'technically' can be omitted (as is evident from the fact that your code works without them) I've found that people whose first language is C# usually use them like so:

if (number % 2 == 0)
{
    type = "even";
}
else
{
    type = "odd";
}

Whereas people who started with a language such as python let the indents do the work for them mostly. The only reason this came up is that it can make it easier to sort the conditions relating to each state within the if/else structure and ensure that code is being placed/executed in the correct places. Potentially, if not careful, the statement:

else if (number % 2 == 0)
    type = "even";
Console.WriteLine(type);

Could be misinterpreted as having the writeline only occurring during the 'else if' portion.

Again, just a curiosity was all :)

Relating to your question, I would definitely have to agree with ddanbe about simplifying your statements. For a multiple possibility if/else there is a definite use for 'else if' but for something where there are only ever 2 possibilities a straight up if/else is enough.

The one thing that concerns me is that, based on your original code, you should never have an unassigned value as there is only …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster
FileStream f = File.Open(@"D:\TestData.txt", FileMode.Create);
f.Close();

Momerath's method will do what you require if all you need is the file to be emptied.

Essentially what it accomplishes is that it will open the file in create mode which makes any existing file with the same name be deleted and replaced with the new file. Further, the code closes the stream without adding to the new file leaving you with an empty new file.

If, on the other hand, you require some of the details of the file to remain then you will need to first read the details into a variable, prune off the unnecessary bits, then create the new same-name file and insert the trimmed contents.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Small addition:
In my country, the comma is the decimal separator.
In other counrtries it is the point.

Good point :) My statement was more towards the way the program looks at it however.

Int = whole numeral = no denomination of decimal or comma

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Let me put it in a different perspective then.

Good
Person A gives an example of their work and is stuck in a particular place where their code isn't working. They've tried a few alternatives and it's apparent that they have the right general idea but are making a mistake or just misunderstood how something worked.
Person B gives a working example showing how it corrects the problem Person A encountered and Person A sees the reasoning and the mistake and corrects their work

Bad
Person A posts a question asking for a handout of code because they haven't bothered to look into or try to solve the issue themselves. They show no effort in their work and show no understanding of the key concepts in coding.
Person B gives a handout with no serious explanation of the concepts behind it.
Person A takes the handout, uses it, completes their project but comes back a week later with the same question (or a variant) because they didn't learn anything.

Not saying 100% that this falls into either category, just stating the logic behind my earlier statement.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

ddanbe has the nail on the head there.

You are parsing text into integers. Any value other than a whole number (no commas) will be unable to be parsed in such a way and will terminate the process.

As a note, comma notation for numerals is not a computational or mathematical representation but a visual addition that, in fact, is rarely in common use any longer. The system doesn't understand 120,000 but would understand 120000. You would need to go into much more depth with your parsing if you want it to be able to handle comma-notation in your input.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Just a brief note here in relation to answering threads.

Person A asks question
Person B gives general answer with conceptual method
Person C gives spoon-fed answer complete with code
Person D gives spoon-fed answer complete with code
Person A takes spoon-fed answers, doesn't bother to look into conceptual method or learn how it works and learns nothing

Just a thought is all :twisted: carry on.

ddanbe commented: Good remark. +7
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Your issue seems to be related to the DataColumn and not the Global from what I'm reading of the error. Your error is contained within the following segment ... dc[1].ToString(); ... It reads to me that you are saying the following:

// Create DataSet ds from db.GetDataSet(Co)
ds = db.GetDataSet(Co);
// Create DataTable dt from the first table of ds
DataTable dt = ds.Tables[0];
            else
            {
                // Change the definition of Co
                Co = new Password('K', "").SetSql();
                // Re-create the dataset ds with new definition
                ds = db.GetDataSet(Co);
                // Create DataRow dr from dt which has not been reinitialized since
                // it's original values were pulled
                DataRow dr = dt.Rows[0];
                // Create DataColumn dc from dt which has not been reinitialized since
                // it's original values were pulled
                DataColumn dc = dt.Columns[0];
                
                // Cycle through the DataRows (you've only made one DataRow definition
                // which is the equivalent of row 0 of your table) within all rows of
                // the datatable
                foreach (DataRow row in dt.Rows)
                {
                    // Cycle through the DataColumns (you've only made one DataColumn
                    // which is the equivalent of column 0 of your table) for the table
                    // based on the dr DataRow
                    foreach (DataColumn column in dr.Table.Columns)
                    {
                        // Change GlobalVar2 to equal array position "1" of dc (which =
                        // dt.Columns[0])
                        Global.GlobalVar2 = dc[1].ToString();
                        // Change GlobalVar3 to equal array position "1" of dc (which =
                        // dt.Columns[0])
                        Global.GlobalVar3 = dc[1].ToString();
                    }
                }
                this.Close();
            }
        }

To be quite honest... between the DataRow …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

My one question relates to the following segment:

if (ctrControl.Controls.Count > 0)
{
    ClearForm(ctrControl);
}

I'm confused as to what you're attempting to achieve here. Essentially, if I'm reading it correctly... You're creating a foreach statement at the top of your code that will cycle through (presumeably) all the controls within your form. You're creating IF checks for each type of control to handle different requirements in 'clearing' them.

Now, if I read it right, you're then saying "If the current control has subcontrols, recursively call this same procedure on the subcontrols."

I can see how this might cause a bit of an issue, particularly as you're creating a loop within a loop and utilizing the same variables for both loops which also act as controlling variables on both loops.

As indicated by rohand, however, it would be much easier to pinpoint specific issues in the code if the actual error was provided from the debugger for us to see :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Ok... I may be missing something here but...

Nowhere in the code you provided does the term 'nvarchar' exist.

So either the issue is not with the portion you provided (ie: in code-behind or in a stored procedure on the DB end) or the error is being relayed incorrectly by you to us :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Just above the box where you post replies you should see the link to 'solve' the thread.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

You'll need to fix the following as well as implementing your search:

DateTime search1 = new DateTime();
string s =  search1.ToString(Console.ReadLine());

I'll rephrase that..you ought ot fix it. Apparently the output is correct, but it is not the intended use of the method and may have unexpected results down the line.

Actually, I'm surprised I missed that myself.

Realistically, unless he's converting the info in the text file to dateTime format for local variable comparison, the dateTime portion doesn't need to exist at all and can entirely be handled by strings. The only place where he would need dateTime is if he was working with a webform or windows form where the inputs would possibly be coming from a date/time picker. In console it's all text and can be done entirely with strings.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I just hope it was more helpful the way I put it the 2nd time (and that I didn't botch the loop/condition)... it took me the length of 2 replies and 1 edit to your first reply to type it all out lol.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

OK... I'll try again...

You used:

Console.WriteLine("Enter the date in format {dd/mm/yyyy} :: ");
            date = DateTime.Parse(Console.ReadLine());
            sw.WriteLine("-------------------------------------------");
            sw.WriteLine("Date :: "+date); // User Input Date
           

            Console.WriteLine("Enter the name of the person you want to meet :: ");
            name = Console.ReadLine();
            sw.WriteLine("Name of the person :: "+name); // User Input Name
           

            Console.WriteLine("Enter the your visit time in format {HH:MM:SS} :: ");
            time = DateTime.Parse(Console.ReadLine());
            sw.WriteLine("Visit time :: "+time); // User Input Time
            sw.WriteLine("-------------------------------------------\n");
            sw.Close();

Now, personally... Where you have the following:

public void search()
        {
            string fName = @"C:\Data.txt ";
            StreamReader testTxt = new StreamReader(fName);
            string allRead = testTxt.ReadToEnd();
             
            Console.WriteLine("Enter the date in format {dd/mm/yyyy} :: ");
            DateTime search1 = new DateTime(); 
            string s =  search1.ToString(Console.ReadLine());
            
       
            if (allRead.Contains(s))
            {
               Console.WriteLine("Found");
             
            }
            else
            {
                Console.WriteLine("not found");
            }

            testTxt.Close();
        }

I would do the following instead:

public void search()
        {
            string fName = @"C:\Data.txt ";
            StreamReader testTxt = new StreamReader(fName);
            // string allRead = testTxt.ReadToEnd();
             
            Console.WriteLine("Enter the date in format {dd/mm/yyyy} :: ");
            DateTime search1 = new DateTime(); 
            string s =  search1.ToString(Console.ReadLine());
            r2 = testTxt.ReadLine()
            bool found = false;
            while (r2 != null && found == false)
            {
                if (r2.Contains(s))
                {
                    Console.WriteLine("found");
                    string tmpRead = "";
                    Console.WriteLine("{0}", r2); // Print Date Found
                    tmpRead = testTxt.ReadLine(); // Read Next Line and Print Name
                    Console.WriteLine("{0}", tmpRead);
                    tmpRead = testTxt.ReadLine(); // Read Next Line and Print Time
                    Console.WriteLine("{0}", tmpRead);
                    found == true
                }
            }
            else
            {
                Console.WriteLine("not found");
            }

            testTxt.Close();
        }

The only drawback to this method being that it will display …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Rather than go into great detail in providing the answer here I'll let others who've provided the answer in the past do my talking for me :twisted:

Below is a code snippet (recommended read for this topic) and a couple of related threads that may help you out:

Snippet (Thanks Ryshad)
Link containing links to other threads that will help

Hope these help solve your issue :) Please remember to mark your thread solved once the issue is resolved. Also, if these don't solve your issue, please provide more info as to what the problem is so we can be more specific with our help.

EDIT: Passing info between layers is similar to passing between forms. Please note the main part of the above snippet/links being that an 'instance' of each layer needs to exist in order to reference components between them.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well you know how many lines the input should be (3 if I read it properly):

  1. Date
  2. Name
  3. Time

Soo....

If I were you I would take the line with the found date and the following 2 lines and input them into 3 corresponding variables.

i.e.:

  1. Found Date on Line 4
  2. Line 4 input into fDate variable
  3. Line 5 input into fName variable
  4. Line 6 input into fTime variable

Those would be the steps, the coding shouldn't be too much of a stretch from there :twisted:

Hope that helps, please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Unless you're planning for there to be a vast number of users logging in simultaneously you should be fine with the server-side solution. You might just want to ensure there are the least possible number of server-calls for the confirmation that you need (ie: once per page instead of once per function that requires login creds).

Hope that helped at least :) Please remember to mark your thread solved once the issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Perhaps I wasn't 'clear' enough with my answer then :P

From what you had said:
>>My question is, should I be storing this information in a http cookie instead of a variable?

And you had indicated one of the concerns was overall processing requirements compared to your variable approach.

My answer basically was to give an overview of the pros/cons of cookie usage for this sort of thing...

Essentially, cookie:

  • user-end = less 'server end' processing
  • User-visible
  • Can be disallowed by the browser negating effectiveness

Server-side user login based variable:

  • Server-end (obviously)
  • Invisible to the user
  • Not affected by browser settings

Beyond that, the choice is yours... If it's being checked against frequently then the cookie method may be better as it doesn't require additional calls to the server to check the bool setting. If it's being checked against infrequently or security is of concern then the server-side bool is better.

Alternately, if you need to use the server-side (hidden from user, better 'security' of information) you can always restrict the call to the beginning and end of the 'login session' and simply pass the value forward from page to page. The problem there is you would need some sort of if/else in place on each page where it checks to see if the value was passed locally from another calling page and if it doesn't find it, it then goes to the server to check there. (dunno …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Another variation on what Ryshad indicated is to simply use the Regex.Split method which works the same as the single character split but allows string definition for the split markers.

This can be done by first defining a regex pattern then using that pattern in your split command as such:

Regex reg = new Regex(@"><");
string[] sections = Regex.Split(inputString, reg);

Or it can be used in the following way:

string[] sections = Regex.Split(inputString, @"><");

That is, of course, unless my brain has completely rotted and I've forgotten how to use Regex already :twisted:

Hope this helps :) I know the thread's a few days old but it's still 'unsolved' so figured maybe more info could be useful.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

There are pros and cons to using a cookie to store login variables for a website.

Pro:

  • Cookies can be set to terminate either at end of session or after a specified time period
  • Cookies are relatively easy to write/read
  • Cookies are client side and don't require much server overhead

Con:

  • Cookies can be read easily and possibly 'impersonated'
  • Cookies can be easily mis-coded
  • Many people disallow cookies on their browsers

There are other factors to consider but my purpose is just to give an overview of cookies' usefulness.

If you utilize non-descript variables in the cookies (such that it's not apparent that it's a login credential) you should be relatively ok using them for this purpose. Keep in mind that unless otherwise coded, cookies self-terminate as soon as all browser windows are closed (ie: browser 'session' ends).

Generally, for the purpose you've described, cookies will likely be the best bet as they are one of the few persistent methods of session state control available. Your only major drawback is that it obviously won't work if the user doesn't allow cookies on their machine.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

The livejournal "icon" that you're referring to is commonly known as a 'favicon' and is generated from an icon file in your web directory (or an image directory which is referenced by the metatag(s) for the favicon in your webpage(s)).

If you click the link I provided above you will see a 'how to' related to favicons that might help you sort out:

  1. Where your current favicon is located
  2. How to create a custom favicon for your site

Hope that helps :) Please remember to mark your thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Realistically... if you had the resolution of the screen and the actual monitor dimensions (inside dimensions vertical and horizontal) then you could do a straight ratio conversion.

For example, my resolution is 1680x1050 but I don't have an actual measuring tape handy to tell you the height and width of the "viewable space" of my screen. It's claimed to be a 22" 16:9 ratio screen though so some mathematics would be able to get you there.

The thing is, if you ask just for the "monitor size" that doesn't take into account the variables of whether it's standard size, wide screen, ultra-wide screen... You'd need to at the very least know the 'size', ratio and resolution setting to be accurate in this.

Dunno if that helps or just confuses the issue further :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I'd recommend that you check out the following search for many links related to the process you're looking for :twisted:

What you're looking for is the Append file access mode which opens an existing file for writing but places new content at the end of the file instead of overwriting from the beginning. For this you can use the standard filestream method of accessing the file and utilize the append access mode or you can use the File.AppendText method depending on your needs.

Hope this helps :)

Geekitygeek commented: google == friend :D +3
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

new_SE Could you please be a bit more specific about what it is you're trying to do here? Your post is far from clear and therefor difficult to answer.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Try to calculate that at the database level, and return the total with your result. your statement should looks like

SELECT NAME, SCORE1, SCORE2, SCORE3, SCORE1 + SCORE2 + SCORE3 AS TOTAL
FROM YOURTABLE

Definitely agree with bisono here that your best bet is to sum the totals at the SQL server end and return the value directly. Not only does this cut down on overhead in your local code but it also provides the 'total' results as part of the returned dataset so they are directly 'related' to the other values you are retrieving and easily retrieved on a line by line basis. This is preferable to performing the calculation after the fact on the code-behind or front-end levels as it 'ties' the results to the source more directly (read: less chance for information mismatch).

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Hi,
what should i use to make the data inserted is in all capital letter?
here is insert statement:

string query = "INSERT into Categories  values (' " + textbox5_value + " ', ' " + textbox6_value + " ', ' " + textbox7_value + " ' )";

strToUpper() is used to make it convert to all capital letter but i don't know where should i put it? can i use this?

You can do it in the following way assuming that your values are already in string form:

string query = "INSERT into Categories  values (' " + textbox5_value.ToUpper() + " ', ' " + textbox6_value.ToUpper() + " ', ' " + textbox7_value.ToUpper() + " ' )";

However, if the input is not in string form then you will need to convert to string prior to appending the .ToUpper().

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

First, are you using one form/page to login and a separate form/page for your welcome? If so, you would need to look at various methods of passing a variable from the login page to the secondary page.

One such method is to pass the variable as a part of a ClientQueryString, however this is hardly a 'secure' method of passing unencrypted user information from page to page as it puts the information right there in the URL for everyone to see.

You can also use cookies or sessions to move the information place to place as needed but there are other issues that can arise from either of these methods, particularly if improperly coded.

If, on the other hand, your login page is one and the same with your main page (which can be accomplished using ASP:Panels and simply hiding the login panel and showing the Welcome panel upon successful login) you can pass the variable directly within the same page as a local variable without the bother of moving it around between pages. This has the combined benefit of keeping the variable information masked from the user end and not requiring messy transferrance of information outside of the local scope.

Not sure if either option will do what you need but hope this helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Perhaps I'm misreading this but...

It sounds to me like you're passing the UN/PW to the DB to check if they're valid for a login and want to then get the UN back from the DB for the purpose of a welcome page.

This may sound silly but... why not simply use the UN that was entered in the first place instead of revisiting the DB for the information?

Alternately, if the DB contains additional information (such as full name in addition to UN/PW) then it should be a simple matter of using a select statement calling the full name column based on a match to the username column. Something along the lines of:

"SELECT fullName from LoginTable WHERE userName='" + providedUN + "'"

and of course providedUN is the username provided in the login process.

Hope this helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Unfortunately I wish to add the "selected items" ( listType.SelectedItem.Text ) to the body of the email...

Just because Rohand's specific example utilized the objEmail.To.Add() example doesn't mean that would be the only thing that would work in this scenario.

Simply replace the unneeded segment with the logic required to insert the specified text to the body of the email as needed and the foreach loop should do what you need.

As indicated, however, if the issue is actually solved, please mark it as solved (link next to the reply text area) so that others (like myself) don't think that more work still needs to be done on this thread :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Nice intro :) nice to see when someone makes an effort instead of posting a one liner (or half liner) to the community intros forum. Welcome to DaniWeb.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

If I understand your question correctly (you didn't give a lot to work with) you're looking for something like this:

SqlDataAdapter da = new SqlDataAdapter ("SELECT * FROM Table WHERE column='@varNameHere'",con);
da.SelectCommand.Parameters.AddWithValue(textBox1.Text);

Essentially, you'd need to modify the correct command type within the adapter with the parameter you wanted to add... I am not 100% sure because I haven't tried to manually override the default adapter methods recently but you may also need to actually set your SELECT statement with the use of the following instead of in the actual adapter declaration in order for the SelectCommand methods to work as well:

da.SelectCommand.CommandText = "SELECT * FROM Table WHERE column='@varNameHere'"

Hope this helps (and hope I'm not butchering it at the same time) :)

EDIT: As I thought (and as saravind pointed out before I could finish typing my reply) you do need to set the CommandText separately instead of in the declaration of the adapter when using parameters :)

AngelicOne commented: cleared me up! thanks +1
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Osirus;

It sounds to me like you're using a WYSIWYG editor for your website coding.

If you're attempting to modify your frameset file (index.html) and you are using, for example, Adobe Dreamweaver you can access the main frameset (and it's associated settings) by going to Modify > Frameset > Edit NoFrames Content.

Other editors generally use a similar method to modify the frameset page itself.

Alternately, you can copy the metatags from your content frames and manually paste them into the index.html file via a text editor like notepad.

Hope that helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well the issue with the background not flowing to the bottom of the screen is probably related to it being within a sub-div. A common issue with DIVs (more specifically with dynamically positioned DIVs) is that they tend to only extend as far as the content they hold... the side-effect being that if the background is contained within the DIV it also gets chopped. This has come up a couple of times here at DaniWeb but I've yet to see a solid solution as there is no real way to force a contained (non-absolute) DIV to full screen length that I'm aware of.

Edit: Some other threads with similar DIV height issues:
thread 1
thread 2

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Not to be a party pooper here but it's not looking so hot in FireFox either... the gradient used for the background/foreground gets dark enough to make the text difficult to read near the bottom and the hatching actually makes my screen get that ever so wonderful 'vibrating' look to it when viewed on my computer.

Another thing to note is that on any page that is not working out to "full length" of the screen it is being viewed on, your gradient background is stopping just below your main content area and leaving a plain background colour for the remainder of the screen. I've included a screenshot so you can see what I mean by this.

Aside from that, as I'm not about to install Safari on my PC to try to view the other issue you're posting about could you maybe go into a bit more detail on what exactly is happening in Safari so those who read your thread might be able to help even if they don't specifically have Safari?

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

It can be difficult to specifically strip code from submitted text in a text box...

Well... not 'difficult' but cumbersome :)

One thing I might recommend would be that you look into Regular Expressions as, using that, you can specify strings to be excluded/filtered from submitted text (such as URLs and script openers). The only drawback with the RegEx method is that you kind of have to be specific about the things you are excluding (ie: if you don't specify it, it won't be excluded).

Another thing you can combine with RegEx filtering is SubString segments (to catch everything between the opening and closing braces of an HTML or script tag for example). Simply grab everything from the first IndexOf to the following closing brace and snip it out. This can add a bit of heft to your coding however and also means a lot more room for error if not coded correctly.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Edit: One thing I forgot to mention is that RegEx is case sensitive so you either need to utilize separate RegEx values for both capital and lower case or convert the input entirely to upper/lower prior to utilizing RegEx on it (which can be detrimental to the valid input from the user).

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Try/Catch generally should be used in any scenario where the outcome of your code is not 100% guaranteed to produce the desired result.

An example would be the file.create example that nssltd posted above but it could also be used for things like database manipulation (try to insert information and catch the error if it doesn't work).

Another component not mentioned above but still part of the try/catch family is "finally" which is a 'catch-all' piece of code which fires after both try and catch have completed their bits. Basically 'try' fires up it's piece of code and if it fails then 'catch' steps up and tries to salvage things so the program doesn't fail entirely. Once either of the first two is completed in what they're doing it moves on to 'finally' who steps in to do whatever needs to be done to finish up the task.

This is all part of the larger picture that is 'error handling' within the C# language. For some additional information about this I suggest reading the first 2-3 listings in this google search as, looking over the list, they all seem to be good reference points for beginner programmers.

Hope that helps :)

Suzie999 commented: clear, to the point +1
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Couple of quick questions to clarify here if possible...

  1. When you say it's closing after 2nd iteration are you talking about the FileSystemWatcher, the DB connection or something else?
  2. Define iterations in this case... are we talking about the button1_Click event which triggers the StartWatcher() procedure?

I'm asking only because as I'm seeing it right now the following is happening (based on the code provided).

  • button1 is clicked
  • folder path is selected
  • StartWatcher is called
  • watcher is set to monitor selected path for *.xls file changes
  • streamwriter is created on file change to write the changed files to a list
  • incident event generated for changed file list
  • Excel workbook opened based on filename in list
  • Somewhere in code that is not provided above a database is updated with information from the excel sheet

Throughout this I'm not seeing anything that calls for the FileSystemWatcher to close, however, is it possible that it is closing from a default timeout period being reached?

Also, as the DB connection information was not provided above I am not sure how the connection opening/closing is being handled or how the information is specifically being passed based on the dX and mX variables indicated above so I can't comment on whether or not there might be an issue there at all.

Don't know if this will help at all but more information on the specifics of what is happening and where would probably help solve this :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Welcome :) Hope you enjoy your stay.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Welcome Daniel, hope you enjoy the forums :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Below the reply text box it should have a link for solving the thread :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I may be completely wrong here but I think your entire problem boils down to this row of code:

<asp:BoundField DataField="Product ID" HeaderText="Product ID" ReadOnly="True" SortExpression="Product ID" />

More specifically to the ReadOnly="True" statement within that row.

This reference at msdn.microsoft.com is similar in nature to yours but different in the way they bound the data within the GridView however what it boiled down to on their end (for the same error and with the same underlying error code) was that they needed to use the equivalent of EVAL instead of BIND for their read-only GridView segments to avoid this issue occurring.

Not sure how to translate that into the <asp:BoundField...> method you're using but it might lead you in the right direction.

Hope this helps :) Please remember to mark threads solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

If I recall from your earlier threads you were writing this with C#/ASP.Net code-behind yes?

If that's the case you can actually (through the use of <asp:hyperlink...>) set your URL dynamically from the code-behind instead of trying to set it dynamically on the front end.

With an ASP Hyperlink on the front-end you can code in the back-end whatever URL you need based on criteria determined prior to page-load (or from selections made within other ASP components within the page).

Basically what you end up with is something like this.

Hope this helps :) Please remember to mark your thread solved once the issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

If you MUST close the first form then you're doing it in the wrong order.

Instead of using:

this.close();
new form3().Show();

Try using:

new form3().Show();
this.close();

If you close the only active form prior to opening a new form you get the inadvertant side-effect of terminating the application in most cases.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

What should I do???

What you should do is post a new thread with your own question.

Include samples of your code (specifically the parts involved in the generation and manipulation of your dateTime component) and details of what you're trying to do with the code so that people can take a look and try to help you :)

Resurrecting a 15+ day old thread with something that is not *directly* related to the original post is usually not going to result in answers for you :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well if you set up the table to have the columnn auto-populate then you are correct, you would not need to add a value when submiting a row from your program.

It's only if you do NOT have the column auto-populating dateTime that you would still need to insert a value at the time that the new row is entered.