|
Hi,
I want to open a Word(.doc) document in a Multiline textbox. Is this possible?
Thank you
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
Illegal Operation wrote: I want to open a Word(.doc) document in a Multiline textbox. Is this possible?
Not directly.
You would have to write code to read the contents of the word file then transfer it into the text box.
|
|
|
|
|
You can use Word Object model to get all the text from word document but it will be just plain text. You can use this control to display doc file: Word Control for .NET[^]
|
|
|
|
|
how can i change back colors or customize save dialog box or an open dialog box using forms...
is it possible using c#...
or is there any language that supports this customizing
ramya
|
|
|
|
|
|
|
Hi Guys
I have a DatagridViewcomboBox column in DataGridView where i m using EditControlShowing on selection Changed but when i select the same combo twise EditControlShowing is not working means It is not unselecting the EditControlShowing
|
|
|
|
|
That's because you haven't change the row you are in. Thus you did not cause the SelectionChange event to fire.
|
|
|
|
|
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface networkInterface in networkInterfaces)
{
Console.WriteLine(networkInterface.Description);
}
How can I get the IP address from each networkInterface ?
Thx...
|
|
|
|
|
You can try something like this:
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties props = adapter.GetIPProperties();
UnicastIPAddressInformation unicastAddress = props.UnicastAddresses.FirstOrDefault(address => address.PrefixOrigin == PrefixOrigin.Dhcp);
Console.WriteLine(unicastAddress.Address);
}
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
i have to create a pop-up window sliding from top to down and insert values to a table. i have completed sliding pop-up window and insertion but it is scrolling from buttom to top where i have scroll it from top to buttom
|
|
|
|
|
Hiya,
Dont kniow if anyone can help - but worth a shot. I am writing an app that takes in 3 values from 3 columns in a CSV (account number, start date, end date). The code i have at the mo only reads 1 column at a time, and i am not too sure how i can read the 3 values and pass them to the stored proc to get processed. The proc takes the values and processes them line by line. At the moment it reads all the column values and inserts it for accounts, date1a, and date2a, whereas i actually only need column 1 for accounts, column 2 for date1a, and column 3 for date2a. I would appreciate any feedback to get a solution as google is not my friend right now .
So far my code looks like this:
private void btnImport_Click(object sender, EventArgs e)
{
try
{
lblShowDetails.Text = "Importing accounts...";
this.Refresh();
DataSet ds = new DataSet();
if (ofd.ShowDialog() == DialogResult.OK)
{
FileStream fs = new FileStream(ofd.FileName, FileMode.Open);
StreamReader s = new StreamReader(fs);
StringBuilder sb = new StringBuilder();
while (s.Peek() >=0)
{
sb.Append("'" + s.ReadLine() + "',");
}
s.Close();
this.Cursor = Cursors.WaitCursor;
lblShowDetails.Text = "Retrieving data from the store...";
this.Refresh();
string accounts = sb.ToString().TrimEnd(",".ToCharArray());
string date1a = sb.ToString().TrimEnd(",".ToCharArray());
string date2a = sb.ToString().TrimEnd(",".ToCharArray());
try
{
ds.Tables.Clear();
if (sCustomer == "Customer1")
{
SqlDataAdapter da = new SqlDataAdapter("storedprocName", con);
da.SelectCommand.CommandTimeout = 0;
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@accounts", SqlDbType.VarChar);
da.SelectCommand.Parameters.Add("@date1", SqlDbType.DateTime);
da.SelectCommand.Parameters.Add("@date1", SqlDbType.DateTime);
da.Fill(ds, "xxx");
grdShowStats.DataSource = ds;
grdShowStats.DataMember = "xxx";
lblShowDetails.Text = "Done with Stats Enquiry...Waiting for next command";
|
|
|
|
|
I can't follow the logic of what you have there... so there must be very little.
Read the file one line at a time, use .Split to separate the values, set those values into the parameters, and then execute. Repeat as required.
|
|
|
|
|
hi,
I'm stuck at a multi-thred issue.
there is a class HibernateDAO<t> with utility methods. this class is never instanciated, since its methods are static.
HibernateDAO<t> has a reference to ISessionFactory, which should be singleton. but this ISessionFactory will be instanciated for each thread seperately (logging will produce the output multiple times).
can someone give me a hint why this behaviour occurs even after wrapping the access with _synclock variable?
public class HibernateDAO<T>
{
static ILog log = LogManager.GetLogger(typeof(HibernateDAO<T>));
static object _synclock = new object();
static ISessionFactory sessionFactory;
public static ISessionFactory SessionFactory
{
get {
lock (_synclock)
{
if (sessionFactory == null)
{
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration().Configure();
cfg.AddAssembly(typeof(T).Assembly);
string conStr = (string)cfg.Properties["hibernate.connection.connection_string"];
log.Info("Trying to establish connection. Connectionstring: " + conStr);
sessionFactory = cfg.BuildSessionFactory();
}
}
return sessionFactory;
}
}
thanks in advance.
|
|
|
|
|
My guess would be it's because you're using generics (not a threading issue at all). Try running this:
static void Main(string[] args)
{
object o = HibernateDAO<object>.SessionFactory;
object s = HibernateDAO<string>.SessionFactory;
object q = HibernateDAO<object>.SessionFactory;
Console.WriteLine(object.ReferenceEquals(o, s) ? "o==s" : "o!=s");
Console.WriteLine(object.ReferenceEquals(o, q) ? "q==s" : "q!=s");
Console.ReadKey();
}
This wil get you:
o!=s<br />
q==s<br />
o and s are not the same because you've actually referenced two different classes entirely: One initialized with an object and one initialized with a string . o and q are in fact the same class of type HibernateDAO<object> , which is not the same as type HibernateDAO<string>.
Standards are great! Everybody should have one!
|
|
|
|
|
Your code here does not show HibernateDAO as static. Also it cannot be static as written due to the generics.
You have to make the class a strong type and define it explicitely as static in order to get a static class.
All you've done is define a static method inside an instance class.
You need something like this:
public static class Hibernate
{
...
}
|
|
|
|
|
Hi,
I have the following problem. On a page I have a multiple selection listbox.
It contains a lot of items. When items near the bottom are selected, and I
do a button click, the control jumps to the top. If there are a lot of items,
this can get very annoying, always having to scroll down to the selected
items (if I want to change them, or something).
Is there any solution so that after button click also the mouse position
remain unchanged.
Thanks & Regards
Mishra
|
|
|
|
|
Ballita wrote: Hi,
I have the following problem. On a page I have a multiple selection listbox.
It contains a lot of items. When items near the bottom are selected, and I
do a button click, the control jumps to the top. If there are a lot of items,
this can get very annoying, always having to scroll down to the selected
items (if I want to change them, or something).
Is there any solution so that after button click also the mouse position
remain unchanged.
Lookup EnsureVisible
|
|
|
|
|
Could you please describe how can i use that.
Thanks & Regards
Mishra
|
|
|
|
|
Ballita wrote: Could you please describe how can i use that.
Did you look it up? What did you find? Where are you stuck?
|
|
|
|
|
hi,
how can i change the regional settings, input locale programatically using c#. input locale has to be applied for the Operating system level. plz help me out..
Thanks in advance.
hemanth
|
|
|
|
|
g_hemanth17 wrote: hi,
how can i change the regional settings, input locale programatically using c#. input locale has to be applied for the Operating system level. plz help me out..
You can create a CultureInfo class and assign to the current thread... is that what you are looking for?
|
|
|
|
|
Thanks for your reply, using cultureinfo we can change the userinterface and IME for the particular form. but i want to change the whole operating system input locale. how could i do that one.
thanks in advance.
hemanth
|
|
|
|
|
If the FormBorderStyle of the main form is set to None, the context menu on the taskbar is no longer accessible, which normally has menus Restore, Minimize, Move and Close when you right-click it.. is there a way at C# to still be able to display the context menu when the FormBorderStyle is set to None?
|
|
|
|
|
I have .NET 3.5 WinForms application. This contains form with
horizontal SplitContainer.
I set SplitterDistance to 30 in OnLoad()
However its value is 41 on OnFormClosing().
I want to obtain original value (30) for restore.
Any idea why value is changing automatically and how to get real value ?
It is interesting that SplitterDistance increases not by certain number of
pixels but by some factor.
First increase is from 30 to 41, i.e 11 pixels.
Seceon increase is frm 41 to a larger number of pixels.
This increasing seems to stop when SplitterDistance reaches to the value
which is set in Form Designer.
protected override void OnLoad(System.EventArgs e) {<br />
base.OnLoad(e);<br />
splitContainer1.SplitterDistance = 30;<br />
}<br />
<br />
protected override void OnFormClosing(FormClosingEventArgs e) {<br />
Settings.SplitterDistance = splitContainer1.SplitterDistance;<br />
base.OnFormClosing(e);<br />
}
Andrus
|
|
|
|