|
Hello all,
I am making a project to finish my subject but I have some problem with the code of program. I am coding a code editor like Notepad++ for C#. I find any help in forum, but I have a problem that I can't find the help.
Well... Someone help me...
I want the code in a funtion or a region can expand and collapse like Nodepad++.
Can you guide me? Can you give the code demo?
Please give me the help to email: nguyenquangsang24@gmail.com
Thank very much.
|
|
|
|
|
|
|
I have a class that has a list of objects.
Since it doesn´t seem to work with xmlSerializer I´m trying to save to a binaryfile instead.
When I use BinaryReader I read a string using ReadString but can I read a List or an object?
|
|
|
|
|
Fisrt off, you should easily be able to serialise a List with XMLSerializer, you just need to ensure that Your custom class is marked with the XmlRoot attribute, and you create a class that inherits from List that holds your collection, something like this
[XmlRoot("Persons")]
public class People : List<Person>
{
}
[XmlRoot("Person")]
public class Person
{
public Person()
{
}
public Person(string name)
{
Name = name;
}
[XmlElement("Name")]
public string Name { get; set; }
}
then you can use this
using (StringWriter writer = new StringWriter())
{
XmlSerializer serializer = new XmlSerializer(typeof(Persons));
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
XmlWriter xmlWriter = XmlWriter.Create(writer, settings);
serializer.Serialize(xmlWriter, personList, namespaces);
}
or something to that effect, and this should work to serialize to XML.
If you still want to serialize to a binary file, you should use a BinaryFormatter like this
using (Stream stream = File.Open("people.bin", FileMode.Create))
{
BinaryFormatter bin = new BinaryFormatter();
bin.Serialize(stream, People);
}
and deserialise also using a BinaryFormatter
using (Stream stream = File.Open("people.bin", FileMode.Open))
{
BinaryFormatter bin = new BinaryFormatter();
var people = (List<Person>)bin.Deserialize(stream);
}
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
We have created a window service in c# and in VS 2005 and when we ran that service on local server which is windows 2003 and SQL Server 2005 (both installed on same server ), the window service ran fine and updated the SQL Server database absolutely fine.
But when we are going live , we have the SQL Server 2005 on a remote database and remote connections are allowed in that (as when I am opening the through sql server management studio where window service will be installed ,its working fine). And I have installed the window service on Windows 2008 R2 Server and installation was fine .
But now the service is not updating our database SQL Server 2005 which is at remote locations. Also we are not sure , where should we what the error is.
I have seen in sql server 2005 properties that Allow Remote Connections to this Server is checked and remote query timeout is set at 600 seconds. And also if to Advanced section of properties , then Network packet size is 4096 and Remote Login Timeout is 120.
Please help regarding this asap as we want to go live. Now I will try other way round , I will install database at 2008 R2 and install window service at windows 2003.
Thanks
Amit.
|
|
|
|
|
Check the system's event log?
|
|
|
|
|
Is the SQL service running as a Network service?
If you go to Configuration Manager, in the SQL service Properties, it has to have the "log on as": Built in Account -> Network service.
Hope this helps.
http://gyazo.com/fc3c3d3cb790b6e71bad0f733fb6b264.png?1336464548
|
|
|
|
|
necesito un ajemplo para capturar la cantidad de paginas que se envian a imprimir y usarlo en c#...si alguien me pudiera ayudar se los agradeceria mucho...
|
|
|
|
|
This is an english-language site.
Please put your question in a translator and present its result to us.
No memory stick has been harmed during establishment of this signature.
|
|
|
|
|
Esto es principalmente un foro inglés. * Si usted publica en inglés, es posible que obtenga un sector más amplio de la comunidad para responder a su pregunta.
(This is mainly an English forum. If you post in English, you are likely to get a larger section of the community to answer your question).
|
|
|
|
|
samuelalvarito wrote: necesito un ajemplo para capturar la cantidad de paginas que se envian a imprimir y usarlo en c#...si alguien me pudiera ayudar se los agradeceria mucho...
Translation...
an example will need to capture the number of pages that are sent to print and use it in c # ... if someone could help me would appreciate it very much
I would be almost certain that google would be able to find examples of printing. And I suspect the same is true about your other questions. Translated that answer is...
Sería casi seguro que Google sería capaz de encontrar ejemplos de impresión. Y sospecho que lo mismo es cierto acerca de sus otras preguntas.
|
|
|
|
|
como interceptar la cantidad de paginas del documentos que se envian a imprimir para adaptarlo a c#
|
|
|
|
|
como usar el evento drag&drop para cargar documentos office en un formulario de c# y luego imprimirlos
|
|
|
|
|
If you post in English, you are likely to get a larger section of the community to answer your question.
|
|
|
|
|
Your form (or better: an element, e.g. a listview on it) has to subscribe for two events: DragEnter and DragDrop.
In DragEnter do something like:
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
Now you'll get a "Plus" cursor when you drag the files into the element.
In DragDrop do something like:
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, true);
foreach (string f in files)
{
}
}
Note that you get the filenames.
|
|
|
|
|
How do I know whether or not to call ReleaseComObject()?
For example in the following code I call ReleaseComObject() on the Worksheet, it works fine, but I dont rearly know if this is correct or not. How would I know? Is there a rule that I need to follow?
try
{
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
string strWorkBook = @"C:\zz\Book1.xlsx";
Workbook workBook = excelApp.Workbooks.Open(strWorkBook,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
int nSheets = workBook.Sheets.Count;
Worksheet sheet = (Worksheet)workBook.Sheets[1];
Marshal.ReleaseComObject(sheet);
workBook.Close(false, strWorkBook, null);
Marshal.ReleaseComObject(workBook);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
“If I had asked people what they wanted, they would have said faster horses.”
― Henry Ford
|
|
|
|
|
As a rule, its advisable to release com objects from managed code.
|
|
|
|
|
|
Hi...
I am using the following code to discover remote devices..using the UUID specified by the OBEX Specification..
But the devices are not being discovered..
Am i missing any other thread?
Thanks in advance...
private bool OBEXOpenStream(string BTMAC)
{
Guid spguid = new Guid("{(uuid128=F9EC7BC4-953C-11D2-984E-525400DC9E09)}");
btaddress = OpenNETCF.Net.BluetoothAddress.Parse(BTMAC);
client = new OpenNETCF.Net.Sockets.BluetoothClient();
endpoint = new OpenNETCF.Net.BluetoothEndPoint(btaddress, spguid);
try
{
client.Connect(endpoint);
}
catch (System.Exception e)
{
return false;
}
stream = client.GetStream();
return true;
}
modified 26-Apr-12 1:27am.
|
|
|
|
|
hello friends,
In my educational period i was study about what is oops(object, class,inheritance,polymorphism,encapsulation and etc) as a theory with simple example,but after now a days i need to create my own classes,but still i am confused at this level,please tell me which way is better to understand and coding with my own way.please refer me any best articles for these topics
|
|
|
|
|
See this[^] article for starters.
/ravi
|
|
|
|
|
|
MP3 Rearrange is a good example of Object Oriented programming. It uses inheritance 5 levels deep. Overriding methods of base classes is used as well.
Take a look.
MP3 Rearrange
Please leave a comment if you like.
Best John
|
|
|
|
|
Short answer: Classes are nouns and their methods are verbs.
Each class maintains its data, and its methods represent actions on that data.
Ideally, once you write a class (and methods) you use it in the rest of your program like that type was built into the language. The only way the rest of the program interacts with it is through its public methods.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|