User Profile
Collapse
-
Web browser control error
I am trying to load a web browser with a web site that contains an IP Address. I am able to load this website in an IE7 window with no issues on my Vista machine. But when I try to load this web site through the web browser control I keep getting the error "System.AccessV iolationExcepti on was unhandled". I then tried this application on my XP machine and the web site loads fine inside of the web browser. I am assuming this has something... -
Are controls empty?
I need to check 4 controls (2 combo boxes and 2 text boxes) and make sure they are not empty. I am unsure of how to do this in c#. I need something like...
Code:If (cbName.Text != String.Empty) AND (cbServer.Text != String.Empty) AND (txtUser.Text != String.Empty) AND (txtPassword.Text != String.Empty) { //do something } else { //do something else }
-
Ok, the following seems to work, although I am still getting errors on a blank text file. I would prefer it would just set the varibles to "" rather than error out...
Code:public class GlobalVariables { private string clienttype; private string servername; private string username; private string password; private string filename = @"C:\Program Files\Picture Capture\Settings.txt";
-
Ok that worked. But now that it is getting to the while(true) statement it is in an infinite loop...it just keeps going through!
Code:try { while(true) { Temp.Add(reader.ReadLine()); } }
Leave a comment:
-
I added those using statements and I am still getting errors on the List<string>. "The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)".
Code:public void GetSettings() { string filename = @"C:\Program Files\Picture Capture\Settings.txt"; if (File.Exists(filename)) { System.IO.StreamReader
Leave a comment:
-
A generic error occurred in GDI+.
I am getting this error. I know it must have something to do with the Memory Streams I am creating, and I am disposing of them, so I am not sure what the problem is. My application has two steps...first to acquire an image from a twain device. I am placing the image into a memory stream and then setting that image from the memory stream to a picture box...
Code:public static System.Drawing.Image DIB_ToImage(System.IntPtr hdib)
-
What is this line...
List<string> Temp = new List<string>();
It is throwing errors.Leave a comment:
-
Check for empty text file
I am reading the contents of a text file into variables. All works well if the text file does not exist, or it does exist and contains 4 rows of data. But I need to account for rows being empty or null. How can I check this?
Code:string filename = @"C:\Program Files\Picture Capture\Settings.txt"; if (File.Exists(filename)) { StreamReader reader = new StreamReader(filename);
-
Yes. This seems to work.
Code:byte[] getimage = (byte[])cmd.ExecuteScalar(); string strfn = Convert.ToString(DateTime.Now.ToFileTime()); FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write); fs.Write(getimage, 0, getimage.Length);
Leave a comment:
-
Get image from SQL and put in Picture Box
I need to select an image from a SQL server table and then show it in a picture box on a form.
Code:private void btnSearch_Click(object sender, EventArgs e) { SearchFunctions sf = new SearchFunctions(txtPracCode.Text,txtMRN.Text, txtFName.Text, txtLName.Text, txtDOB.Text, txtSSN.Text, 0); long PersonID = Convert.ToInt32(sf.PersonSearch()); if (PersonID != 0)
-
-
Thanks, that solved that issue. I guess I am having a hard time letting go of the VB.NET I am used to!
But now I am getting an error on the line...
rdr = cmd.ExecuteScal ar();
"Cannot implicitly convert type 'object' to 'System.Data.Sq lClient.SqlData Reader'. An explicit conversion exists (are you missing a cast?)"Leave a comment:
-
Parameter Direction Output
I have an SQL Stored Procedure that is outputting (using scope_indentity ) the PersonID after a record is inserted into the table. I need this outputted value to be returned to my application. I have tried the following but I am getting errors..."Non-invocable member 'System.Data.Sq lClient.SqlComm and.Parameters' cannot be used like a method." on the line "cmd.Parameters ("@PersonID").D irection = ParameterDirect ion.Output;"...
No activity results to display
Show More
Leave a comment: