|
Designing a real editor is a fairly complicated proposition. Take a look at http://www.gnu.org/ to get a feel for what you are diving into.
Mike
|
|
|
|
|
It's not an editor like Emacs I am trying to make. It's a hex editor. It simply reads a file, displays the content in hex and ascii format and allows the user to change byte-values
|
|
|
|
|
Under .net framework, we can use reflection to get a object's all properties,such as:
PropertyInfo[] p= label1.gettype().getproperties();
But, if the object is office application object, we donot get the properties using same reflection, such as:
Word.BookMark wdbk=word_applicationclass.ActiveDocument.bookmark[1]
PropertyInfo[] p= wdbk.gettype().getproperties();
why? how to get the all properties?
thank you very much.
|
|
|
|
|
Hello
I am having a lot of trouble with binding a ds to a text box control.
I have a query SELECT Name, Address, PostCode FROM Customer
This query fills the dataset. This works fine as l have tested this in my web service. The xml displays the name, address, and postcode.
But l get my error message when l try and bind this to the text box control. I have tried many things and l now that the syntax is right. Am l missing something.
//Error Message - Cannot create a child list for field Customer
txtName.DataBindings.Add("Text",ds,"Customer.Name");
txtAddress.DataBindings.Add("Text",ds,"Customer.Address");
txtPostcode.DataBindings.Add("Text",ds,"Customer.PostCode");
many thanks in advance,
Steve
|
|
|
|
|
I'm trying to import a csv text file into a datagrid. when i get it done, only the first field in the text file appears. i'm not sure why. am i only getting one field into the data set? or are all the fields getting into the data set and i'm only transfering one field to the data grid?
here's my code:
string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataFiles;Extended Properties=""text;HDR=Yes;FMT=TabDelimited""";
OleDbConnection conn = new OleDbConnection(strConnection);
string selectString = "Select * From [sellerEngine_1.txt]";
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = selectString;
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
conn.Open();
string dataTableName = "SellerEngine";
da.Fill(ds, dataTableName);
DataTable dt = ds.Tables[dataTableName];
dataGrid1.DataSource = dt.DefaultView;
conn.Close();
thanks!
Thomas Barker
|
|
|
|
|
Hi
Does anybody know if there is any format that I can use in the String.Format(..) method to write an integer appended with the "st" or "nd" or "rd" or "th" without having to write custom code?
Thanks
|
|
|
|
|
|
Adding a ICON to a Statusbar is catered for in C# through the Statusbar property. So... I created a couple icons and then used the following code:
Icon myIcon = new Icon(@"..\..\Stop.ico");<br />
statusBar1.Panels.Add(String.Empty);<br />
statusBar1.Panels.Add(" ");<br />
.<br />
.<br />
.<br />
statusbar1.Panels[0].Icon = myIcon;
Compiles fine but the icon does not display. The icon is a 32x32 icon created thru Add New Item.../Icon file. Any ideas here?
Thanks in advance
Mike
|
|
|
|
|
The only thing you need to do is to set the ShowPanels property of the StatusBar to true.
Hope this works!
Pablo Hernandez Valdes
|
|
|
|
|
Hey,
I'm trying to search for a string in a datatable using DataView.Find, and ran across the Regex class. I got the find and select to work when the whole string is found, but now I need it to work for just part of the string.
Here's what I have so far:
// tCat - the table name
// searchThis - the string I want to find
// dg - the datagrid
DataView dv = tCat.DefaultView; <br />
Regex reg = new Regex(searchThis,RegexOptions.IgnoreCase);<br />
if (searchBy == "cust")<br />
{<br />
dv.Sort = "Customer ASC";<br />
int i = dv.Find(reg);<br />
if(i > dv.Table.Rows.Count || i < 0){MessageBox.Show("No file found");}<br />
else {dg.CurrentRowIndex = i; dg.Select(i);}<br />
}
I saw that IsMatch finds parts of strings, but I need to be sure that only the beginning of a string will partially match, i.e. searching for "rich" will match "Richard", but not "Fredrich".
So at the moment I'm not sure how to incorporate the IsMatch into the code above, as well as make sure that only the beginning of the string is searched.
Thanks again for any help!!!!!
Mel
|
|
|
|
|
Just add the ^ modifier at the beginning of the regex.
searchThis = @"^rich";
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi again,
I tried this:
searchThis = @"^" + s.SearchThis;
since I'm transferring searchThis over from another class. It didn't work so I changed the line:
int i = dv.Find(@"^Rich");
to test and see if the row containing Richard would highlight, and it didn't.
Is there anything else I may be doing wrong?
Thanks again!
Mel
|
|
|
|
|
Well, the regex matches only if Rich is at the beginning of the string. Like
string x = "Richard rocks";
string y = "I am rich;"
Are you sure if the string starts with Rich? Maybe you are dealing with a multiline string? Could you post a sample string?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
The string definitely seems to start with Rich. I tried substituting the entire name
int i = dv.Find("Richard Chalmers");
and it worked fine. I also tried another test name "Penske", and it again worked ok if "penske" was typed in, but not if I tried @"^Pen".
Mel
|
|
|
|
|
I'm confused now. What does dv.Find do? Could you try out this little code snippet and tell me what it prints and if that's what you expect?
string x = "Richard Rocks";
string y = "My rich uncle";
Regex regex = new Regex(@"^Rich");
Console.WriteLine(regex.IsMatch(x));
Console.WriteLine(regex.IsMatch(y));
It should print True and False. Is that what you expect?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Ok, I did get the true and false, but it doesn't make sense (to me) why I'd have trouble below.
What my dv.Find does is get the row number in the datatable that contains "Rich" in it so that I can highlight it.
I have the code in the first post, but where the problem seems to be is:
DataView dv = tCat.DefaultView;<br />
Regex reg = new Regex(@"^Rich");<br />
int i = dv.Find(reg);
When I have "Richard" instead of @"^Rich", it highlights the row just fine.
Any other thoughts?????
Thanks again for your help,
Mel
|
|
|
|
|
You sure DataView.Find handles regexes? MSDN[^] doesn't say anything about it handling regular expressions.
Regards Senthil _____________________________ My Blog | My Articles | WinMacro
|
|
|
|
|
I've go a Custom Control that inherits from the TextBox class and I've added a ListBox; I needed to create a custom event exposed to the parent form that would fire when the ListBox changed visiblity. The code below works but I know it's now quite right. Any help appreciated.
Control Code Snippet==============================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
public delegate void ListBoxEvent();
namespace TextBoxLookupLib
{
///
/// Custom Textbox Control
///
public class TextBoxLookup : System.Windows.Forms.TextBox
{
private System.Windows.Forms.ListBox listBox1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public event ListBoxEvent ListBoxVisibleChanged;
public TextBoxLookup()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitComponent call
this.listBox1.Visible = false;
this.listBox1.Width = this.Width;
this.listBox1.TabStop = false;
this.DoubleClick +=new EventHandler(TextBoxLookup_DoubleClick);
this.listBox1.DoubleClick +=new EventHandler(listBox1_DoubleClick);
this.listBox1.VisibleChanged +=new EventHandler(listBox1_VisibleChanged);
ListBoxVisibleChanged += new ListBoxEvent(OnListBoxVisibleChanged);
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(17, 17);
this.listBox1.Name = "listBox1";
this.listBox1.TabIndex = 0;
}
#endregion
private void OpenListBox()
{
Control ctlParent = this.Parent;
ctlParent.Controls.Add(this.listBox1);
this.listBox1.Width = this.Width;
this.listBox1.BringToFront();
this.listBox1.Visible = true;
}
private void CloseListBox()
{
this.Focus();
this.listBox1.Visible = false;
this.listBox1.SendToBack();
this.Refresh();
}
private void TextBoxLookup_DoubleClick(object sender, EventArgs e)
{
this.OpenListBox();
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
this.CloseListBox();
}
private void listBox1_VisibleChanged(object sender, EventArgs e)
{
ListBoxVisibleChanged();
}
public void OnListBoxVisibleChanged()
{
//Why this method call?
}
}
}
Form Code Snippet=============================================
this.textBoxLookup1.ListBoxVisibleChanged +=new ListBoxEvent(textBoxLookup1_ListBoxVisibleChanged);
private void textBoxLookup1_ListBoxVisibleChanged()
{
if(this.textBoxLookup1.ListSelectedValue != null)
this.textBox1.Text = this.textBoxLookup1.ListSelectedValue;
}
"She folds her legs...in doing so I glimpse Xanadu."--Gilby
|
|
|
|
|
How to save my paint on a form or a picture box ?
|
|
|
|
|
I'm having trouble finding resources related to sound recording and streaming those files. Effect I want to make is identical to Skype (or other IM) voice chat... I want to be able to capture sound using microphone, compress it, send it over wire using .NET Remoting and than, of course, play it.
However most project I've find deal with saving file to disk, or just compressing some file... So does anyone has some expirience in this field and is willing to share it?
tnx in advance
|
|
|
|
|
how to create a dll file. where, and how it is used?
|
|
|
|
|
ambedkar wrote: how to create a dll file.
Create a Class Library project
ambedkar wrote: where, and how it is used?
A DLL is, in .NET, a type of assembly that is usually a Class Library. Code behind for ASP.NET applications compile to DLL files.
It is used to hold libraries of code. For example, The business logic of an application may be put in a DLL in order to separate it from the user interface. A set of custom controls may be put in a DLL. Test fixtures are normally placed in a separate DLL from the set of classes that they test.
Basically, any code that is invoked from somewhere else.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Is anyone has an idea how do I generate 6 digits unique number for the same day. (Based on time ?!) The number should be milliseconds difference.
10x
TD
|
|
|
|
|
Ronent wrote: how do I generate 6 digits unique number for the same day
same day as what? To what is the day in comparison?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
A quick check of the number of milliseconds in a day gives 86400000
TimeSpan ts = new TimeSpan(1,0,0,0,0);<br />
Console.WriteLine(ts.TotalMilliseconds);
So, first point you are not going to be able to generate a unique 6 digit number, that is millisecond different, based on the current millisecond in a given day.
Lets see how accurate it could be....
Max 6 digit number = 999999
Milliseconds in a day = 86400000
Spread = 86400000 / 999999 = 86.4ms (approx)
So every 86.4ms (thats 0.086 seconds) a new number would be generated, every call to generate a number within that timespan would create the same number.
Now, your choices
1) If your app will never make a call to generate this number as frequently as every 100ms, you are free to use the above solution. Just get the current number of miiliseconds since midnight, divide by (approx - do the math) 86.4, round to the nearest integer and you will have a 6 digit whole number.
2) If you DO actually need this accurate within 1ms (which i doubt) you can use a bigger number (Milliseconds is usually depicted as an int).
|
|
|
|