Fenrir() 52 Newbie Poster

Are you still getting the same exception? Did you add the ) to the following line

"insert into BookDetails(CarName,Source,Destination,Date,FromAddress,ToAddress,Time,Numberpassengers)VALUES(@CarName,@Source,@Destination,@Date,@FromAddress,@ToAddress,@Time,@Numberpassengers)"  <----
Fenrir() 52 Newbie Poster

An easy way to see exactly what's going wrong is inserting a breakpoint on line 29 on the above code extract. Then investigate the value of the cmd query by using the text visualizer. Copy the code from there directly into sql and parsing it to sql standards. Run the query and see where the syntax error is. but just for the fun of it you're missing a ")" at the end of your values statement.

Fenrir() 52 Newbie Poster

You can use some simple regex to achieve what you want but from past experience this can get quite verbose and inefficient i would suggest trying Click Here

Fenrir() 52 Newbie Poster

I assume you're reading the data into an array. You know that your date will be in column 1 and your Summe would be in your last column so on each readline of the file you only retrieve these two values based on their index in the array.

Fenrir() 52 Newbie Poster

This might not be an ideal solution but you can try copying the file in your C# code and then reading from it and try to keep the file up to date. Depending on the file size i don't think it will be possible to synchronize the two application.

Fenrir() 52 Newbie Poster

Try this

DELETE  Personaldata.*,Spouse.* from Personaldata INNER JOIN Spouse ON Spouse.LotNo = Personaldata.LotNo
Fenrir() 52 Newbie Poster

Your problem is due to encapsulation

        if (textBox1.Text == "1")
            MessageBox.Show("Hello1");
        else
            MessageBox.Show("Hello2");
        MessageBox.Show("Hello3");

If the textbox 1 text property is 1 the messagebox will show Hello1 and Hello 3

if it's not 1 the messagebox will show Hello 2 and hello 3

If you change the code as follows

            if (textBox1.Text == "1")
                MessageBox.Show("Hello1");
            else
            {
                MessageBox.Show("Hello3");
                MessageBox.Show("Hello4");
            }

The messagebox will only show Hello1 if the text property is 1

Alternatively you can use a return; statement in your code

MessageBox.Show("Username or Password seems invalid, please use email to recover password/username");
return;
Fenrir() 52 Newbie Poster

Say you have a grid and you want users to be able to disable and enable grid Columns and the grid is pulling from a view. You now add a radio button for each column but as soon as the view changes you have to add another radio button which can cause the screen to become cluttered. You now have a method that loops all column and adds it to a checklistbox without you having to add a component and recompile your application.

Fenrir() 52 Newbie Poster

What is the error you are getting?

Fenrir() 52 Newbie Poster

You can drag a OpenFileDialog Component on your screen and set it up in code like this openFileDialog1.Filter = "PDF File (*.pdf)|*.pdf|All Files (*.*)|*.*"; you can get the filename after selecting a file like this OpenFileDialog.FileName As for manipulating the contents of a pdf you can try something like this Click Here You can use this to extract the contents of a pdf to a text file

Fenrir() 52 Newbie Poster

So you want the Link Label to point to a page not created by you? If that's the case you can use something like this System.Diagnostics.Process.Start("http://WebsiteName");inside the onClick method

Fenrir() 52 Newbie Poster

Are you manually populating your grid? Or did you specify it in your properties?

Fenrir() 52 Newbie Poster

You only need to specify list.add not items

Fenrir() 52 Newbie Poster

Okay so you have the string from the database so next you need to find the image in the resources. Did you manually add them to resources? are they inside an image list? At runtime just create a List<string> containing all your resource images. And match them by checking If (List.Contains("Image"))if it finds a match then you can can add the image from the resource.

foreach (string image in System.IO.Directory.GetFiles(@"Resources\"))
{
  MyList.Items.Add(image);
}

This is to get the initial list of your resources. Again i'm not sure how you you added the images to your project.

Fenrir() 52 Newbie Poster

Once you have the image from the database the first step is done. Richtextbox doesn't have default methods for adding images so that's why i suggested that first article. Have you gone through it?

Fenrir() 52 Newbie Poster

Are you saving the physical image? or just the path.. Try this Click Here you will still need to first link to get your image into the Richedit.

Fenrir() 52 Newbie Poster

This might help you get started Click Here

Fenrir() 52 Newbie Poster

myConn.Open(); add a breakpoint here and step your code and see on exactly what line it throws an exception

Fenrir() 52 Newbie Poster

You should be able to add the key with the corresponding progressbar to something like a dictionary Dictionary<Char,ProgressBar> and then on keypress check your dictionary and retrieve the relevant entry

Fenrir() 52 Newbie Poster

When Loading your data into the dropdownlist try adding if(!IsPostBack){}

Fenrir() 52 Newbie Poster

So you're getting Message - > Username? Sorry i don't quite understand your question. Please post the code aswell

Fenrir() 52 Newbie Poster

Is it always going to be in this &nbsp;hlo<div><br></div> Format? and only the hlo part changes? if that's the case there are numerous methods you can use just off the top of my head something like this

string test = "&nbsp;hlo<div><br></div>";
test = test.Substring(test.IndexOf(";")+1, test.IndexOf("<") - test.IndexOf(";")-1);
Fenrir() 52 Newbie Poster

MySqlCommand SelectCommand = new MySqlCommand("select * from livestream.views where video_id ='" + videoid + "' and ACTIVE=1 ", myConn); when you insert a breakpoint on this line. What is the value of the videoid ? and when you run this directly in SQL how many values are returned?

Try this when you step your code hover over the select command and use the text visualizer and copy the code directly into SQL

Fenrir() 52 Newbie Poster

Please post your code. How are you declaring the array?

Fenrir() 52 Newbie Poster

When you insert a breakpoint you can step your code. Highlight and rightclick the combobox you can then inspect the Value and Display members and check if they are correct.

Fenrir() 52 Newbie Poster

I tested the code i provided and it works perfectly what difficulties are you experiencing? I populate a datagridcombobox with all the weeks and every time you select a week it populates the other columns in the row of the combobox based on the selection with data it fetches from SQL.

Fenrir() 52 Newbie Poster

You basically need an onChangeEvent for the datagridviewcomboboxcolumn. And this will need to be created. I used this in a previous project Click Here As for selecting the data. You have the selected value in the combobox and the event for populating the rest of the columns.

In the DoSomeStuff(); Section you add something like the following

SqlConnection con = new SqlConnection(@"Data Source=YourDataSourceName;Initial Catalog=DatabaseName;Integrated Security=False;User ID=[User];Password=[Password]");
string Command = "SELECT WeekNumber FROM Weeks WHERE WeekID = "+combo.SelectedItem.ToString().Replace(System.Environment.NewLine,"")+"";
SqlCommand com = new SqlCommand(Command, con);
con.Open();
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
{
  dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[dataGridView1.CurrentCell.ColumnIndex+1].Value = reader[0].ToString();
  //Adds data to column right next to combobox column at the specified index
}
con.Close();
Fenrir() 52 Newbie Poster

Click Here you can try this. But this is weird behaviour it should already be topmost. If i had this problem i would propbably just create a new form for my dialog and set the property TopMost there.

Fenrir() 52 Newbie Poster

You can just build a simple select query and in the where specify you value. Initialize a DataReader and insert the values based on the current row index.

Fenrir() 52 Newbie Poster

So every row basically has a parameter and based on that parameter you want to populate the current rows columns?

Fenrir() 52 Newbie Poster

string videoID = myReader.GetString("video_id"); this sould be in your combobox you select from by my understanding. Is that the physical ID? If you select from views based on the video ID then you should get the people who viewed that video. Otherwise when you populate the Video ID combobox and you're displaying the video name you will need to Set the value member and display member

Fenrir() 52 Newbie Poster

SELECT u_id FROM Views WHERE video_id = "+YourComboBox.SelectedItem.ToString()+"

Fenrir() 52 Newbie Poster

You have the video ID so i assume your second query is just a standard select aswell. So when you're selecting you can just initialize another reader and loop through the User Id's you return. So as John suggested you can then create a list<string> outside your loop and add the items to it. Once your DataReader (While) has finished and the list is populated you can then assing the list to the RichTextbox as follows RichTextBox.Lines = myList.ToArray();

So it should look something like this

//Declare your list

List<string> list = new List<string>

while (myReader.Read()) 
{
string userID = myReader.GetString("user_id");
list.add(UserID);
}

RichTextBox.Lines = list.ToArray();

I hope this helps you

Fenrir() 52 Newbie Poster

Am i getting this right : you want the "video_id" returned by your reader so you can pass it into another query to retrieve the values? If that is the case you need to declare the variable outside your method so you can use it in another. So string videoID; needs to be moved outside the method and only assigned in the comboBox1_SelectedIndexChanged as follows videoID = myReader.GetString("video_id"); and then you can use it in your other query.

Fenrir() 52 Newbie Poster

Please post your code that you use to populate your combobox with titles.

Fenrir() 52 Newbie Poster

.

Fenrir() 52 Newbie Poster

This seems like a homework assingment. And a quick google brought me to this Click Here

Fenrir() 52 Newbie Poster

I think it will be better to test your query in SQL first. You can do the JOIN logic in SQL and merely pass the string to SQL via a SQLCommand. Reading your previous comments led me to the conclusion that johnrosswrock's previous comment is what you need. You want to retrieve all the users that viewed the selected video? Is that correct?

Fenrir() 52 Newbie Poster

Try disposing the attachment before your delete statement.

data.Dispose();

Fenrir() 52 Newbie Poster

How are you sending the email? If the objects used to send the email are properly disposed in your code then you should have no problem deleteing the PDF

Fenrir() 52 Newbie Poster

You need to create a URI from the filepath. This link should help Click Here

Fenrir() 52 Newbie Poster

Yes you can Click Here

There are many examples on the web.

Fenrir() 52 Newbie Poster

Click Here there are alot of useful links in this article.

Fenrir() 52 Newbie Poster

The Listbox.Text property is used to Search for specific text. So what you are actually doing is searching the listbox for dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString(); the method george suggested will work.

Fenrir() 52 Newbie Poster

Are you writing anything to the registry? In windows vista the if the application throws an error the "application has stopped working dialog will appear" make sure you have all the nessecary permissions.

Fenrir() 52 Newbie Poster

Like george asked is this on the SQL server side or in your application?

Fenrir() 52 Newbie Poster

Click Here try this. if your date is varchar you will need to convert it Click Here

Fenrir() 52 Newbie Poster

This can sometimes be solved by just changing the framework to an earlier version like 3. Have you tried this?

Fenrir() 52 Newbie Poster

It sound like you're trying to achieve a captcha. This link is for ASP.NET but you can easily convert it to Desktop etc.. Click Here

Fenrir() 52 Newbie Poster

Well this might be a bad example but you can accomplish this by doing the following.

Add a counter for each picturebox
In the form load set the PictureBox.Image property to Imagelist.Images[Counter] for each picturebox
In the Previous and Next buttons Increment and Decrement the Counters.
Add a general method that accepts the Picturebox and the Counter
In the method add a try block and try to set the picturebox image to the imagelist.Picture[Counter]
in the catch block add Picturebox.Image = null; and Picturebox.Refresh();

First way i could think of off the top of my head.

Regards