|
hi,
put bellow lines before your class funtion and after your class function called.
MessageBox.Show(treeView1.Parent.Name);
----------------
Description:
In your function in class i thing u create new tree view control and return the same. In this case parent control + location + size does not exist. After that when you assign to your control it behaves like it has no parent.
----------
Solution:
1) pass tree view of the form in to class function
tell me if u get any prob
|
|
|
|
|
that worked. thanks sooooooooooooooooo much!!
|
|
|
|
|
Hi,
How I can print from a page Web towards a connected serial printer to my PC?
I must make a Javascript? or that advises to me.
The impression routines work from a program Windows to me.
Thanks.
|
|
|
|
|
It a little hard to understand what you are trying to say but i'll take a guess.
if you need to get a webpage to print you are correct you will need to use javascript. its very straight forward... http://www.javascript-page.com/printpage.html
|
|
|
|
|
Sorry my English.
The printing to serial printer is line by line, ok. In C# Windows Forms works good.
Can i do it same in Web?
Is it possible?
Thank for you reply.
|
|
|
|
|
I have a datagrid bound to a dataview. I created some functionality to add new rows and delete rows. When I delete an row and click on the save button to save to the database I get the following message:
"Deleted row information cannot be accessed through the row".
And the delete obviously fails. Anyone with ideas on this?
|
|
|
|
|
Hi there,
i implemented a virtual listview component making use of "LVS_OWNERDATA"-style in C#; everything works fine so far, but if the component looses focus and gets it again, you will get an "ArgumentOutOfRange"-exception caused by "FocusedItem"-method...
i tried to override the method, but this certainly not works, the implementation takes always the original method code...
any ideas?
regards,
tajbender
|
|
|
|
|
Hi,
How can I wrap the GUID type in .Net?
Thanks.
|
|
|
|
|
You don't need to. You can use the System.Guid class.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi,
When I want to specify an SQL query I am using the below code:
mySqlCommand.CommandText = "SELECT name, surname FROM people WHERE name = 'James' AND surname = 'Brown'";
But how can I do this if I don't want to write down the surname(use a variable instead of that)? I used below code but couldn't get a result:
string buffer_surname = textBox1.Text;
mySqlCommand.CommandText = "SELECT name, surname FROM people WHERE name = 'James' AND surname = '@buffer_surname'";
???
Thank you,
Cem Louis
|
|
|
|
|
string buffer_surname = textBox1.Text;
mySqlCommand.CommandText = "SELECT name, surname FROM people WHERE name = 'James' AND surname = '" + buffer_surname.ToString() + "'";
You also should probably do a replace and replace any apostrophes with double apostrophes in buffer_surname, just in case.
Hope this helps.
|
|
|
|
|
|
Look a few posts down at Heath's response about an SQL statement. While it is very humorous, he is also VERY correct. You have the same issue.
|
|
|
|
|
Hi,
I used the below code to EMPTY a table which is named people but it is not working???:
<br />
SqlConnection mySqlConnection4 = new SqlConnection("Initial Catalog=mydb;Data Source=" + comboBox1.SelectedItem.ToString() + ";Integrated Security=SSPI;");<br />
mySqlConnection4.Open();<br />
SqlCommand mySqlCommand4 = mySqlConnection4.CreateCommand();<br />
SqlTransaction myTrans;<br />
myTrans = mySqlConnection4.BeginTransaction(IsolationLevel.ReadCommitted,"SampleTransaction");<br />
mySqlCommand4.Connection = mySqlConnection4;<br />
mySqlCommand4.Transaction = myTrans;<br />
mySqlCommand4.CommandText = "EMPTY people" ;<br />
myTrans.Commit();<br />
mySqlConnection4.Close();<br />
Anyway What is the problem???
Thank you by the way...
Cem Louis
|
|
|
|
|
The issue is:
You are given an array of integers of size n containing values in the range 1 to n-1. Obviously there’s at least one duplicate value in this array. Please let me know the algorithm for finding one such duplicate value.
Thanks.
|
|
|
|
|
There are many ways you can go about doing this. There are a few questions you should look at first though. Is the array sorted? Can you define another data structure? Are you trying to keep the complexity below a certain level?
I might do something like the following:
for (int iSize = 0; iSize < yourArray.Count; iSize++)<br />
{<br />
while (yourArray[iSize] != iSize)<br />
{<br />
if (yourArray[iSize] == yourArray[yourArray[iSize]])<br />
{<br />
MessageBox.Show( "Duplicate value of " + yourArray[iSize].ToString() );<br />
iSize = yourArray.Count;<br />
break;<br />
}<br />
Swap(yourArray[iSize], yourArray[yourArray[iSize]]);<br />
}<br />
}
I didn't really test this, just pulled it off the top of my head real quick. It might work, but I can't give any guarantees.
Good luck
|
|
|
|
|
I have a weird problem that started happening.
I have a tabcontrol with 3 tabs, and each tab has its own ListBox control.
I populate the listbox controls from a dataset i retreive from a database. Everything here is fine.
The problem comes when the data is displayed. The ListBox does contain a collection, and all the items are selectable, BUT they are invisible.
Every item in the listbox remains Invisible until I do the following:
- Move the form (by dragging with the mouse)
- Change the tab (redraws the listbox control)
Once I do that, the listbox items are viewable.
Can anyone give me any insight as to what is happening here?
Jon G
www.Gizmocoder.com
|
|
|
|
|
Can anyone suggest the easiest way to scan a photo from a c# application ... is the Windows Image Acquistion Automation Layer the way to go? or should I purchase a third party control such as what AtalaSoft, LeadTools or PegasusImaging provides? ... does anyone have any experience any of with these tools?
I need my C# app to tell any scanner to scan the current image ideally into its raw image format (so no image correction is applied) and it all needs to be from managed code.
Thanks in advance.
Rob
|
|
|
|
|
Whenever i look at the source for one all i can think of is a c++ headerfile...i.e. a prototype of a class.
what purpose do they serve?
|
|
|
|
|
well, a very good question... i'm relatively new to c# programming, too, and wondered also what they can do for me...
well, interfaces look like classes, except (see C# in a nutshell):
- the don't deliver implementations to their members, but a specification; so they are in some parts identical to abstract classes
- one class/structure can implement more than one interface, but one class can only derive from one base class
- a struct can implement an interface, but can not derive from a base class
the clue is, to define basic operations that every derived class/struct has to implement; the implementation itself may look different, but the aim of the called operations has to be the same...
let's say you implement a webshop; you know three different account types: a paypal account, a bank account and a credit card account; all types use different properties to describe the account; however, all derive from interface "IPaymentTransferAccount"
when your customer buys something from you, all have to implement a method called "GetMoneyFrom(float bucksCount, Currency currency)" - each of them has its own implementation of initializing the money transfer, but in your code, you only call "IPaymentTransferAccount account = Customer.Account; account.GetMoneyFrom(price, Currency.USD);"
finally, you need no "dummy"-implementation in a base class, but each of it can implement many other interfaces where appropriate, that's it.
hope that helps,
regards,
tajbender
|
|
|
|
|
FocusedWolf wrote:
what purpose do they serve?
An interface ensures that when something wants to invoke methods on a class implementing the interface, that those methods exist and have a particular signature. It's like a contract. If you inherit from an interface, your class is saying "I'm implementing the methods that are defined in the interface, so anyone who knows about the interface can use my methods."
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
Wow i think i understand them now! So interfaces were made solely to make sure people deriving from a class followed the same naming conventions and provided for the same functionality in their classes?
Here's a test program i wrote that helped me out:
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
#endregion
namespace ConsoleApplication1
{
interface Wolf
{
string Fur{get; set;}
string Teeth{get; set;}
void Hunger(string food);
}
class WereWolf : Wolf
{
public WereWolf()
{
Console.Write("WereWolf mode engaged\n\n");
}
private string fur;
public string Fur
{
get { return this.fur; }
set { this.fur = value; }
}
private string teeth;
public string Teeth
{
get { return this.teeth; }
set { this.teeth = value; }
}
public void Hunger(string food)
{
string chew = food;
}
}
class RealWolf : Wolf
{
public RealWolf()
{
Console.Write("RealWolf mode engaged\n\n");
}
private string fur;
public string Fur
{
get { return this.fur; }
set { this.fur = value; }
}
private string teeth;
public string Teeth
{
get { return this.teeth; }
set { this.teeth = value; }
}
public void Hunger(string food)
{
string chew = food;
}
}
class Program : WereWolf
{
static void Main()
{
WereWolf were = new WereWolf();
Console.Write("What color is the wolf that's chewing on you? ");
were.Fur = Console.ReadLine();
Console.Write("How many teeth does it have? ");
were.Teeth = Console.ReadLine();
}
}
}
|
|
|
|
|
FocusedWolf wrote:
So interfaces were made solely to make sure people deriving from a class followed the same naming conventions and provided for the same functionality in their classes?
That's 1/2 of it. The other half is that someone that USES the interface is guaranteed that a class (which can be totally unknown) derived from the interface actually implements the methods in the interface.
In your example (and it's customary to prefix a class name with an "I" if it's an interface, so Wolf would be IWolf), your main would look more like this:
class Program
{
static void Main()
{
IWolf awolf = Factory.MakeWolf();
Console.Write("What color is the wolf that's chewing on you? ");
awolf.Fur = Console.ReadLine();
Console.Write("How many teeth does it have? ");
awolf.Teeth = Console.ReadLine();
}
Now, Factory.MakeWolf() is a static method that maybe looks at some configuration information somewhere and either returns an instance of WereWolf or RegularWolf. The point is, the Main() program doesn't care which--it assigns the instance to the interface that all specialized Wolf classes implement. It can then call methods on those instances because the interface says that they must exist.
Another reason for interfaces is that C# doesn't support multiple inheritance, but you CAN specify multiple interfaces, which is sometimes a useful way of having one specialized class that implements several different interfaces.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
Hello ,
I have a problem, rich text bullets are not displayed in Crystal report.
Environment : VS .NET 2003
CrystalDecisions.CrystalReports.Engine Version 9.1.5000.0 ( it came with .NET 2003 package)
CrystalDecisions.ReportSource
The problem is , I have application with rich text box, Just I cut and paste the text from wordpad , it looks like
· ABC
· CDE
· FGH
· JKL
Then I saved the TEXT into SQL server database (as a ntext format ).
Now on the crystal report , I config the database filed as a “RICHText”( from paragraph tab).
When I view the report . I am not getting the “bullets “
I checked the rich text for the above statement using Text Interpretation -à None
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}{\f1\fnil\fcharset2 Symbol;}}
\viewkind4\uc1\pard{\pntext\f1\'B7\tab}{\*\pn\pnlvlblt\pnf1\pnindent0{\pntxtb\'B7}}\fi-360\li360\lang1033\f0\fs21 ABC\par
{\pntext\f1\'B7\tab}CDE\par
{\pntext\f1\'B7\tab}FGH\par
{\pntext\f1\'B7\tab}JKL\par
}
can someone help me Why I am not getting the bullets and numbering in crystal report display ?
thanks
Sundar
|
|
|
|
|
Hi there!
I have a problem here and I need your help.
I have two arrays and I need to make a convolution of them.
something like that
//result = conv(a,b);
I know that in matlab I have a function to make the convolution, and in C#?!!
I need to make the convolution or is there any function that make the convolution for me?
Thank you all, Sérgio
|
|
|
|