|
now i know listView1.Items[0].BackColor = Color.Red;
.......... srry u should before answer
"" q1: I HAVE MANY ITEM 11 ROM BACKGROUND COLOR IS RED BUT I HAVE 2 ROW TO CHANG
BACKGROUND ONLY HOW? ""
|
|
|
|
|
BackColor = myListView.BackColor?
Once again, I have no idea what you're asking.
|
|
|
|
|
I recently reinstalled visual studio, but now when i try to add a class (project -> add class) instead of having a class, i have an option to add an interface...and instead of windows form i have inherited form.
Is there a way to add the form and class templates?
|
|
|
|
|
have you tried the /resetsettings switch when running devenv?
|
|
|
|
|
um, i don't really know how to do that =[
and it's a fresh installation so i don't know if resetting settings would help, it's already it's default
|
|
|
|
|
Start up Visual Studio by the command line, passing /resetSettings as a command line argument.
If you don't know how to start applications with command line arguments, you should learn how to do that before continuing programming.
Does right-click on your project -> New Item... -> Class work?
|
|
|
|
|
i did resetsettings and it didn't work, and when i right click-add item on my project i don't have a class but when i do the same on the solution i do...=\
|
|
|
|
|
Maybe your project's type, intentional or not, is such that it can not hold classes.
sharpiesharpie wrote: when i do the same on the solution i do...=
I doubt that, the only thing a solution can hold is projects.
Did you have disk problems ? Did you edit solution/project files manually ?
I suggest you try again, at least with a new project inside the existing solution;
better yet with a new solution and new project.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
obviously...i said it's been that way since i installed VS (after formatting) =/
|
|
|
|
|
I don't know why I'm having some many issues with this, but some help would be appreciated. I'm working on a unit test. I need to get my image saved to a string and placed in my XML document. Below is the code that almost works... The part that doesn't work is when I write the byte array of the image contents to the String Builder. Only part of it comes out, then the StringBuilder object just quits working and doesn't write any more after.
StringBuilder xmlString = new StringBuilder();
xmlString.AppendLine("<TranslationRoot>");
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(25, 25);
for (int i = 0; i < 25; i++)
{
for (int j = 0; j < 25; j++)
{
Color pixelColor = bitmap.GetPixel(i, j);
int r = pixelColor.R;
int b = pixelColor.B;
Color newColor = Color.FromArgb(r, 0, b);
bitmap.SetPixel(i, j, newColor);
}
}
MemoryStream gifStream = new MemoryStream();
bitmap.Save(gifStream, System.Drawing.Imaging.ImageFormat.Gif);
System.Text.UnicodeEncoding encoding = new UnicodeEncoding();
byte[] gifByte = new byte[gifStream.Length];
gifStream.Position = 0;
gifStream.Read(gifByte, 0, gifByte.Length);
xmlString.Append(" <Value><![CDATA[" + encoding.GetString(gifByte) + "]]></Value>");
The last line of the XML looks like:
<Value><![CDATA[䥇㡆愹÷}
So after that last append, any additional appends just don't work. No error is thrown. So any help is appreciated.
Thanks!
Hogan
|
|
|
|
|
Hi,
XML is supposed to be readable text, and structured as well.
Inserfting a lot of arbitrary bytes will not preserve these characteristics;
some of your bytes will happen to be < or > signs, others will be negative, etc.
So you need a way to encode (and later decode) arbitrary bytes into printable characters
or strings.
A popular way of doing that is with Convert.ToBase64String(); this will generate a string
from a limited set of 64 characters; it generates one character for every 6-bits of
input data, hence it expands the data by 8/6 in size. That's the price to pay to keep
it readable/printable, and XML-compatible.
Decoding that string is done with Convert.FromBase64String().
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc,
Thanks for your reply. That is exactly what I needed to do. Its the second time you have replied to my help and I sincerely thank you!
Hogan
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Ok, listen here. I have an application which code I cannot access. It has an Inactivity timer which is running. If I dont touch the pc for more than a certain ammount of time a message will show and log me out. Id like to know how to stop this by writing some code to make it look as though someone is active in windows when really they are not.
The only thing i can think of is creating a timer and sending some sort of message to windows to make it look as though we are active.
Thanks in Advance.
www.codewash.com
|
|
|
|
|
It depends exactly how it defines activity. Theres plenty of apps around if you search for something like "mouse mover".
|
|
|
|
|
|
Thanks Dinobot_Slag, we are on the right track. I need to figure out now how to send like a wm message or somthing so that the hooks being used by the application will see it and believe we are active.
www.codewash.com
|
|
|
|
|
Hi I'm looking to my queries to an Access database in C# that is password protected and I am having difficulties. The password is 13 characters long and contains capital, lowercase, symbols (#$%^) and numbers. My connection string looks like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\file.mdb;User ID=admin;Password=P@$$w0rD";
When I call:
OleDbConnection myConnection = new OleDbConnection(connectionString);<br />
myConnection.Open();
The program crashes with an unhandled exception of type 'System.Data.OleDb.OleDbException in system.data.dll.
I did some research and it says that C# handles special characters in a way that isn't compatible with some access databases. I'm not sure if $%^ are special characters, or if that means just unicode.
Does anyone know where I'm slipping up or how to fix this? Any advice would be appreciated.
|
|
|
|
|
Ken Mazaika wrote: The program crashes with an unhandled exception of type 'System.Data.OleDb.OleDbException in system.data.dll.
And what did the exception message say? That is quite important becuase there are many reasons it might throw an exception of that type.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
The message box said "Microsoft Development Environment" in the titlebar, the words "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll" and Break, Continue, Ignore (disabled), and Help buttons.
The debugger highlights the line immediately following the Open(), which happens to be return true;
thanks,
-Ken
|
|
|
|
|
Just to eliminate an obvious error: I am assuming you are using the @ symbol at the beginning of your connection string assignment.
string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\file.mdb;User ID=admin; Password=P@$$w0rD";
If not, then you should be using a double backslash when listing your Source:
Source=C:\\file.mdb;
|
|
|
|
|
Sorry, I did use a double backslash I just changed the code to a different path to be simpler. Thanks though,
-Ken
|
|
|
|
|
I figured out the answer thanks to another user's post on a particular article here.
To access a password protected database you can add another part to the connection string. I added this to the end of it and it works like a charm.
jet OLEDB:Database Password=mypassword;
I'm not sure why the password needs to be listed twice, but it seems to work. I also had issues doing this with Toolbox>Data>OleDbConnection wizard that matched my results pretty well. Hardcoding the connection string with that added fixes it though.
-Ken
|
|
|
|
|
How do I change the Windows Hours in run time?
I want to click on a button and add hours at the Windows-time.
Help-me please.
Cheers.
|
|
|
|
|
Hello,
The 'kernel32.dll' funktion 'SetLocalTime' will help you.
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct SystemTime
{
public short sYear;
public short sMonth;
public short sDayOfWeek;
public short sDay;
public short sHour;
public short sMinute;
public short sSecond;
public short sMilliSeconds;
}
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool SetLocalTime(ref SystemTime time);
Hope it helps!
All the best,
Martin
|
|
|
|