|
Hi,
I've put a datagrid in a tabPage. As in most cases the number of collumns exceed the width of the screen.
How can I make a scrollbar appear in this case ? (so horizontal,vertical)
More info. The tabControl holding the tabpage is put in an Panel.
Thanks in advance
|
|
|
|
|
I have a rather complex project in C# - that contains, among others, a Panel on which I have a number of objects of the same UserControl Type. The UserControl contains 4 PictureBoxes on it. Each PictureBox has an image associated to it, from the resources.. Sometimes, very rarely, but it happens, I get the following error:
System.ArgumentException: Invalid parameter used.
at System.Drawing.Image.get_Width()
at System.Drawing.Image.get_Size()
at System.Windows.Forms.PictureBox.GetPreferredSize()
at System.Windows.Forms.PictureBox.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.LayoutManager.LayoutDockedControls(Control container, LayoutEventArgs levent)
at System.Windows.Forms.LayoutManager.OnLayout(Control container, LayoutEventArgs levent)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(Control affectedControl, String affectedProperty)
at System.Windows.Forms.Control.PerformLayout()
at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.WmShowWindow(Message& m)
I am not quite sure, but I think I ususally obtain this error when scrolling the panel on which the user controls are situated. The error, as I've said, happens only very seldom. I can't provide the code, since it is very large.
Any help would be greatly appreciatedly - maybe someone got into the same problem.
|
|
|
|
|
Hello, a simple question (or not), I want to register more than 1 channel http at the same application. I just want to do something like this:
System.Runtime.Remoting.Channels.Http.HttpChannel ch1 = new System.Runtime.Remoting.Channels.Http.HttpChannel(8100);
System.Runtime.Remoting.Channels.Http.HttpChannel ch2 = new System.Runtime.Remoting.Channels.Http.HttpChannel(8101);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(ch1);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(ch2);
Or a way for change the channel name.
tks
Wender Oliveira
.NET Programmer
|
|
|
|
|
Hello everyone
I'm just starting a project in C# sending data back and forth from a Pocket PC to a desktop machine.
I'm using sockets at the minute and it seems pretty straight forward to do this over WIFI or in a cradle via activesync but I'm struggling to find much to help me move this to use GPRS on say an XDA II.
I'm sure it can be done but I've not seen any examples or instructions in any books or on the web - can any of you guys point me in the right direction? I've seen examples of "Connection Manager" but it all seems to be C++ - can this be used in C# somehow?
Many Thanks
Matthew
|
|
|
|
|
Hi guys,
I have just been fiddling with a DataGrid for the first time and have managed to display pretty much what I want, except that it always highlights cell 0,0.
Is there an option somewhere that will stop this as it makes the grid look really nasty. The only option I could find that stopped it was DataGrid1.enabled = false but of course this has lots of other unwanted side-effects such as the columns cannot be resized by the user.
Any ideas would be much appreciated
Mike
|
|
|
|
|
I am programming in C# and I want to get direct access to the harddrive to read data and maybe later also write data.
I have looked at msdn but I dont really know what to search for. Maybe someone know what native functions I should call?, or point me in the right direction.
Thanks! // Anders
------------------------------
http://www.anderslinder.se
|
|
|
|
|
It's not accessing the hard drive directly, but you could call functions from the Win32 API. The page below covers the functions you can use. If you go to http://www.pinvoke.net/ you ought to be able to find the P/Invoke signatures to let you use them. Alternatively, you could created a class wrapper in Managed C++ that called the functions directly, and then consume that within your C# app.
http://jan.netcomp.monash.edu.au/ssw/files/win32.html[^]
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
Thanks for the fast answer. I think I know what I should do now.
// Anders
------------------------------
http://www.anderslinder.se
|
|
|
|
|
|
I've not got any experience with Gentle.NET, have you considered NHibernate? It's still in Alpha but I believe that what it does provide is pretty stable and reasonably well tested (i.e. production quality), and I also believe it supports cascading deletes. As for a default mapping of commands to stored procedures, I don't know. You may also want to take a look at iBATIS.NET.
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
Seems like there're plenty of Object-Relational mapping tools around. Some of the desirable features includes:
1. transaction
2. referential integrity, cascade deletes...
3. auto-increment, uid generation
4. inheritance
5. supports used of stored procedures
6. database/provider independent access
7. generation of SQL scripts from UML
...
What important feature have I omitted here? For our project, [1], [2], [3] are basic requirements. [4], [5], [7] are "nice-to-have". [6] ... we're just working with SQL server, but the rest of our application are built pretty robustly that ... we'd prefer OR mapping tools to be data provider independent... so, let's say [6] is also a requirement.
Anyway, anyone familiar with history of OR mapping tools? Which are the most popular OR tools around?
Norman Fung
|
|
|
|
|
Hi Everyone,
i got a big problem here. I need to reproduce the behaviour of the Photoshop layer blending mode "Hard Light". If I use Photoshop load up a picture and put a layer with a solid color on top of that picture and set this layers Blending Mode to "Hard Light" then the Color of the layer seems to be mixed with the lights and darks of the underlying picture.
Then i went to my c# application:
I thought well take the overlapping pixels of the picture and the layer and mix the HSV Values together. But whatever i do i can't make it look like photoshop.
Does anyone have a clue or hint that could point me into the right direction to be able to reproduce that blending in C# ???
Any help greatly appreciated !!!
Thanks,
Oliver
|
|
|
|
|
|
Hi All,
I've a class file written using VB 6.0.
The class file has some complex methods.
Now I need to use that methods in my C# project.
It is too hard to convert the Vb code to C#.
By googling I came to know that, we can create interop wrapper to attain this goal.But I'm not aware of interop wrapper even what is that.
Pls. can anyone give me the urls or sample code on this topic ?.
Your help would be greatly appreciated.
DHARMA.R
|
|
|
|
|
You'll have to expose the VB code as an ActiveX DLL, enabling you to use .NET's COM interop support.
Here's an MSDN article that talks you through it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkCOMInteropPart1CClientTutorial.asp[^]
You'll need to scroll down a bit, to where it says Example 1: Using Tlbimp. This imports the type library, creating a managed gateway to the COM interfaces implemented by the server. All you have to do then is ensure you reference the generated assembly when compiling.
Alternatively, (if you want) you can actually declare the interfaces and GUIDs inside C# through applying attributes. Again, this is documented inside the MSDN article. However, if you've got a large interface you will probably prefer the automated approach.
For more information about .NET's interoperability, you'll definitely want to check out this section in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconinteroperatingwithunmanagedcode.asp[^]
It covers things like threading, marshaling of types, lifecycle etc.
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
Hi
I have to read any schema file, and according to their datatype, it should load values for about 200 into a new xml file.
ie, a rough xml(first file -resulatant file)
<name>john1</name>
<salary>8100</salary>
<name>john2</name>
<salary>8200</salary>
<name>john3</name>
<salary>8300</salary>
<name>john4</name>
<salary>8400</salary>
like so on.. for about 200 values.
Now I have another xml file which has same "name" field all meaningful values for about 50.
(second xml file)
<name>john milton</name>
<name>stephen</name>
<name>george</name>
<name>thomas</name>
<name>paul</name> like so on for about 50 data's.
Now coming to my program, when it reads the schema, and when the schema file has the field"name" then it should read the second file and insert the data's from second file into the first xml (resultant file) for that particular field.
This is my requirement.
and this is my coding done, after running this program, i find that an error showing as "An unhandled exception system.argument exception occured"
please explain why is it occuring and how to rectify it.
Here is that part of the coding
private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0;
XmlTextReader xtr = new XmlTextReader("C:\\CDEV\\testdatagenerator\\billtoname.xml");
while(xtr.Read())
{
foreach (DataColumn dColmn in dTbl.Columns)
{
oValues[i] = "";
if((xtr.NodeType == XmlNodeType.Element) && (xtr.Name == dColmn.ColumnName.ToString()))
{
switch(dColmn.DataType.ToString())
{
case "System.String":
oValues[i] = (string) "sachin" + i;
break;
case "System.Int32":
oValues[i] = (int) 100 + i;
break;
case "System.DateTime":
oValues[i] = new DateTime(2004,01,30).AddDays(i * 1);
break;
case "System.Decimal":
oValues[i] = new Decimal(10000900.99) + i;
break;
case "System.Int16":
oValues[i] = (short) 32767 - i;
break;
case "System.Int64":
oValues[i] = (long) 400 - i;
break;
case "System.Double":
oValues[i] = (double) 888888 - i;
break;
case "System.Single":
oValues[i] = (float) 4.5f + i;
break;
}
}
}
}
i = i+1;
dTbl.Rows.Add(oValues);
}
}
private void button3_Click(object sender, System.EventArgs e)
{
dataSet1.WriteXml(txtXml.Text,XmlWriteMode.IgnoreSchema );
MessageBox.Show("Saved");
}
}
}
|
|
|
|
|
Try stepping into the code to see which line throws the exception and repost.
If i remember correctly a System.ArgumentException is thrown when one of your
arguments passed into a function are of the incorrect type.
Kev
|
|
|
|
|
I've been asked to create an installer package for a service this morning.
Now, installing the service is nice and easy, InstallUtil "ServiceName.exe"
But i have to start the service automatically as well, anyone know how to do it?
I was hoping there would be an exe i can run or an optional parameter with
InstallUtil but i can't find anything.
Cheers
Kev
|
|
|
|
|
How to let my .net program supporting Ole Automation?
Give some examples for best.
me
|
|
|
|
|
Read Interoperating with Unmanaged Code[^] in the .NET Framework, especially sections about importing COM typelibs into .NET, and exposing your .NET assemblies to COM clients.
There are many articles here on Code Project that discuss this that you can searching using the textbox directly below the logo at the top of every page on this site, and you can click "Search comments" above this forum to search for the hundreds of threads we've discussed previous.
Start by reading those links from above to get a better understand. If you have any specific questions, please ask. This forum is not a suitable place to get an overview of a technology, but to ask questions that we can answe without writing a book (which, BTW, many books on COM interop with .NET already exist - just search Amazon.com[^]).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I often wonder what is the difference between build and rebuild. When I am developing a project I sometimes use build and sometimes use rebuild. I seem to get the same results.
What is the purpose of having both when they do the same job?
If there is a difference between the 2, which one should I use and when?
Thanks in advance,
Steve
|
|
|
|
|
And you should get the same results; but, if you read the Visual Studio .NET Product Documentation[^] - specifically about Building, Debugging, and Testing[^] - you would see that a build performs an incrementable build in a debug build, which only compiles source files that haven't changed into the assembly. In release mode, the build option - like the rebuild option in both configurations - cleans out the intermediate and object files (like the assemblies, which is a target output file) and builds all the sources since their object libraries don't exist.
This is true of just about every build system - including make and nmake - I've ever used or have read about. This allows you to compile your changes more quickly in order to get debugging and spending less time waiting for larger projects to recompile.
The result is the same, more or less. Intermediate linking doesn't produce as efficient libraries as rebuilding, which is why the default configuration for release builds has incremental linking turned off. For C# projects, this is reflected by the "Incremental Build" project under the "Advanced" section of the project options dialog.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Are multimple threads allowed to access simultaneously the same method of an instance object?
What happend then? they both run a different 'instance' of the method?
|
|
|
|
|
sb777 wrote:
Are multimple threads allowed to access simultaneously the same method of an instance object?
Yes
sb777 wrote:
What happend then? they both run a different 'instance' of the method?
No, method variables lives on the stack, and each thread maintains its own stack. Example:
public class TestClass
{
public static int Test(int i)
{
int retval = i;
return retval;
}
}
Let's assume that two different threads, tA and tB, invokes TestClass.Test:
tA pushes the 'i' integer argument on its stack, let's say the value is 42, and then it invokes
TestClass.Test.
tB pushes the 'i' integer argument on its stack, let's say the value is 9, and then it invokes TestClass.Test.
In both cases TestClass.Test makes room for the variable retval by pushing an integer to the stack of the current thread. It then sets the value of that integer to the value of i. And the value of i is found on the stack of the current thread. When you write 'return retval' you actually tells the compiler to push retval on the stack of the current thread.
So, in the example above, nothing can go wrong in a multithreaded environment. Things are getting ugly if the example looks like this though:
public class TestClass
{
private static int j;
public int J
{
get:
{
return j;
}
set:
{
j = value;
}
}
public static int Test(int i)
{
int retval = i;
return retval + j;
}
}
Things are looking good right untill retval is added to j . The problem is that j lives on the heap, so both threads will access the same reference to j . This is where you, the programmer, needs to actually think (ugh!). At some point in you code, you must find the sequence of code that isn't threadsafe, and then you must wrap it in a lock block like this:
lock(aReferenceToAnObjectSharedByBothThreads)
{
TestClass.J = x;
int y = TestClass.Test(x + 1);
}
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
First, Thanks for your answer.
Now, why did you use static method for your example? Is the same story true for instance methods?
|
|
|
|
|