.manifest files, .config files, and UNC paths
I've written a test program that shows that .manifest files and
.config files won't work together when the app is run from a UNC path.
Has anyone fixed this problem?
To recreate the problem:
1. create an app named UNCTest with 1 button and 1 label on it. Add
the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = ConfigurationSettings.AppSettings("AttachRoot") &
"xyz"
End Sub
2. Add the following UNCTest.exe.manifest file to the project.
<?xml version="1.0" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Winweb.UNCTest"
type="win32"
/>
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
3. Add the following app.config file to the project:
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="AttachRoot" value="\\test\test\test\test\" />
</appSettings>
</configuration>
4. compile the application and put it out on the network. Make sure to
manually copy the .manifest file - it doesn't automatically move the
bin folder like the .config file does.
5. map a drive to the network share where you put the exe and run the
program. No problems when you click the button - you should get
\\test\test\test\test\xyz in the label
6. run the program from a UNC (\\server\folder\UNCTest.exe). You
should get a different result - just xyz (it's not reading the value
from the .config file correctly).
I've seen several Usenet messages about removing encoding from the
.config and/or .manifest files - I've tried this and it doesn't work
(note the two files above don't have encoding attributes). I can't
use Application.EnableVisualStyles, either, b/c this blows up my app
(even if I use Application.DoEvents right after).
So, is there any OTHER workaround so I can enable XP styles, AND use a
config file, AND run my app from a UNC path?
matt tag Tag: Query Builder Tag: 75879
.manifest files, .config files, and UNC paths
I've written a test program that shows that .manifest files and
.config files won't work together when the app is run from a UNC path.
Has anyone fixed this problem?
To recreate the problem:
1. create an app named UNCTest with 1 button and 1 label on it. Add
the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = ConfigurationSettings.AppSettings("AttachRoot") &
"xyz"
End Sub
2. Add the following UNCTest.exe.manifest file to the project.
<?xml version="1.0" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Winweb.UNCTest"
type="win32"
/>
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
3. Add the following app.config file to the project:
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="AttachRoot" value="\\test\test\test\test\" />
</appSettings>
</configuration>
4. compile the application and put it out on the network. Make sure to
manually copy the .manifest file - it doesn't automatically move the
bin folder like the .config file does.
5. map a drive to the network share where you put the exe and run the
program. No problems when you click the button - you should get
\\test\test\test\test\xyz in the label
6. run the program from a UNC (\\server\folder\UNCTest.exe). You
should get a different result - just xyz (it's not reading the value
from the .config file correctly).
I've seen several Usenet messages about removing encoding from the
.config and/or .manifest files - I've tried this and it doesn't work
(note the two files above don't have encoding attributes). I can't
use Application.EnableVisualStyles, either, b/c this blows up my app
(even if I use Application.DoEvents right after).
So, is there any OTHER workaround so I can enable XP styles, AND use a
config file, AND run my app from a UNC path?
matt tag Tag: Query Builder Tag: 75878
disabling the shift selection from textbox?
when you hold down the shift key, and click on the textbox, it will
select the text from the original cursor position to the place you
click.
i want to disable this feature but remains everything else of the
click.
how can i do that? Tag: Query Builder Tag: 75868
REPOST: Displaying and Editing a Time value in a PropertyGrid
When using a PropertyGrid, I have an object with a Date property, but I am
only interested in the Time portion. How do I make the PropertyGrid allow
editing the time only? Just the hours and minutes, preferably?
Thanks
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address. Tag: Query Builder Tag: 75867
About DLL Addin
Hi friends,
I, Tushar Patil, doing project using C#,MS-SQL server.
I want to develope project with one functionality & send it to my
client.(Setup)
Next time when I develope additional functionality, I just want to send dll
to my client.(just like AddIn to Outlook) i.e. My new functionality is an
add-in to my client. And he will add this functionality to his installed
Project.
Is .NET support this? Do you any solution for this? Is there is any url
that explain this type of development in details? Tag: Query Builder Tag: 75865
How to get the right character set / language to show in a RichTextBox?
I'm new to unicode and language issues. Basically I have a RichTextBox and
I'm filling it with a string that could be any number of different
languages. Sometimes the characters show up correctly - ie Chinese, Korean,
etc, but sometimes they just show up as junk. If I know what the language
it is supposed to be, is there any way I can select the proper codepage
and/or encoding? I'm using C# btw.
TIA Tag: Query Builder Tag: 75864
About DLL
Hi friends,
I, Tushar Patil, doing project using C#,MS-SQL server.
I want to develope project with one functionality & send it to my
client.(Setup)
Next time when I develope additional functionality, I just want to send dll
to my client.(just like AddIn to Outlook) i.e. My new functionality is an
add-in to my client. And he will add this functionality to his installed
Project.
Is .NET support this? Do you any solution for this? Is there is any url
that explain this type of development in details? Tag: Query Builder Tag: 75863
About DLL ADDIN
Hi friends,
I, Tushar Patil, doing project using C#,MS-SQL server.
I want to develope project with one functionality & send it to my
client.(Setup)
Next time when I develope additional functionality, I just want to send dll
to my client.(just like AddIn to Outlook) i.e. My new functionality is an
add-in to my client. And he will add this functionality to his installed
Project.
Is .NET support this? Do you any solution for this? Is there is any url
that explain this type of development in details? Tag: Query Builder Tag: 75862
DataGrid - row background colors - re-paint issues
For my DataGrid application, what I need to do was display certain
rows in one background color and certain rows in another based on
changes in one column. I extended the DataGridTextBoxColumn class -
essentially creating my own custom DataGridColoredTextBoxColumn class.
Inside of that class I was able to override the Paint method:
protected override void Paint(System.Drawing.Graphics g,
System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager
source, int rowNum, System.Drawing.Brush backBrush,
System.Drawing.Brush foreBrush, bool alignToRight)
{
and through some other method calls, am indeed able to color the
backgrounds of my rows the way I want. The problems start happening
when I scroll up and down or left and right. The repaint is horrific
- leaving remnants of other cells where new cells just appeared due to
scrolling and the colors get all out of whack )-: Does anyone have
any ideas how to avoid this crappy repaint issue?? I've tried
blocking the base.paint from getting called once the grid has been
painted to my satisfaction, but this leaves me looking at nothing.
Need help - thanks in advance!! Tag: Query Builder Tag: 75861
Sql Adapter in windows forms application vs webservice
I am somewhat new to .NET and am working on a windows forms application in C#.
My application will be accessing a database on a different machine than the windows application. About 10 instances of the windows forms application will be accessing the database at any given time. No other application needs to use the data.
From a performance standpoint, is it better to have the windows forms application access the database with sqlAdapters right in the application, or is it better to use a webservice to return a dataset?
Thank you!
--------------------------------
From: Dan Davenport
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>7a7axUTmckGIOjSO8NMGyA==</Id> Tag: Query Builder Tag: 75859
timer
Hello ,
I have a program where i am using timers to refresh the databinded to
daatgrid for every 10 seconds.Along with this i am having other functions
for updating , sorting etc.
the program terminates while in run mode due when i try to do
updating/sorting since refreshing function will be happening simultaneously.
How to solve this, by which type of thread.?
regards
Thanks
Ushas Tag: Query Builder Tag: 75856
ActiveDocumentHost DOA
Is it true that the ActiveDocumentHost feature in the VS2005 beta will not
make it to final product?
This is a real shame, will there ever be a way to host a word/excel document
in a windows form - It would appear not unless/until we have a managed code
version of word/excel.
Please don't suggest the webbrowser its read only and dsoFramer is not
elegant.
A. Tag: Query Builder Tag: 75855
How to see when a Combox.Text is empty?
Hi,
How can you see if a DataBound ComboBox is empty? When I selected an Item,
and afterwards I press "Delete" there isn't a value visible for the user,
but the applciation still 'thinks' there is a value in it: the Text-property
remains the last value, just like the SelectedIndex and SelectedValue... My
user should be able to chose either a value out of the list, or nothing (=
empty combobox).
Does anybody knows how to do this? And with which event I can trigger this,
because the MyComboBox.SelectedIndexChanged doesn't work on such a moment...
Thansk a lot in advance,
Pieter Tag: Query Builder Tag: 75854
Refresh controls when changing Regional Settings
The following code successfully executes when the user changes the
language in Windows Regional Settings.
I didn't manage to refresh the controls on the interface to show the new
language.
thanks,
SystemEvents.UserPreferenceChanged += new
UserPreferenceChangedEventHandler(userPreferencesChanged);
private void userPreferencesChanged(object sender,
UserPreferenceChangedEventArgs e)
{
switch(e.Category)
{
case UserPreferenceCategory.Locale:
MessageBox.Show("Changed locale");
this.Refresh();
break;
default:
MessageBox.Show(e.Category.ToString());
break;
}
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Query Builder Tag: 75852
datagrid
Hi
In my code i have used combobox inside datagrid,
while i am updating back i am keeping the last value in the bind and using
these values , and new set of changed values i am updating .
Grid contains only 2 columns.
The problem now is while i am keeping the binded data of the gris in an
array, i want to keep the combobox value, not the displayed data.
please help me out.,
Thanks &
regards
ushas Tag: Query Builder Tag: 75847
Hide the controls of Tab Control
When using TabControl GUI component, I would like to hide the controls of
the tab and to show just the content of the panel of the tab.
User of the application don't need to see the buttons of the tab, because
the switch between tabs is done by external GUI component. Tag: Query Builder Tag: 75846
implement a Join between 2 DataTables (Dynamic SQL generation is not supported against multiple base tables)
Hi,
For my VB.NET application I have the following situation:
2 tables on my SQL Server: tblAccounts and tblRules. For each Account there
are many Rules (so tblRules is linked to my tblAccounts by the Account). In
the tblAccounts thee is a field Company which occurs many times (there is
more than one Account for each Company:).
Whet I want to do on my Fom is this: I have a combobox with all my company's
in it. When I choce a Company in it, I want it to give me all the Rules for
all the Accounts that this Company has.
I tried it like this:
'TblRULES
strSql = "SELECT * FROM tblRules INNER JOIN tblAccounts ON
tblRules.Account = tblAccounts.Account"
Dim cmdSql As New SqlCommand(strSql, conSql)
dadRules = New SqlDataAdapter(cmdSql)
Dim cbSql As New SqlCommandBuilder(dadRules)
cbSql.GetUpdateCommand()
dtsRules = New DataSet
dadRules.Fill(dtsRules, "tblRules")
Unfortunately this gives me this error:
Dynamic SQL generation is not supported against multiple base tables. at
System.Data.Common.CommandBuilder.BuildInformation(DataTable schemaTable)
So I guess it's not good to put a join in a SqlCommand and try to do an
Update afterwards on it. The 'good' way should be to somewhere be able to
put tblRules and tblAccounts as two different tables in my DataSet, and
perform the Join n the DataSet or something like that when I need to do a
search on the Company.
does anybody knows how to do this? Or to get rid of that error? I just need
the best way to get this working!
Thanks a lot in advance! Any help will be really appreciated!
Pieter Tag: Query Builder Tag: 75844
Binding Custom Objects to DataGrid
Hello,
I am trying to bind custom business objects and sub objects to a datagrid.
I am able to bind properties of an Array of, lets say Employee objects to a
datagrid. However, I am having trouble binding to an property that points to
another object, let say Address.
Here is an example:
-----------------------
// Get Array of Employee Objects.
Employee[] emps = EmployeeDAC.Get();
dataGrid.dataSource = emps;
//
// Use DataGridTableStyles to display properties.
//
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = SubcontractorSchema.TableName;
tableStyle.MappingName = "Employee";
// Employee Name. (This works)
col = new DataGridTextBoxColumn();
col.MappingName = "Name";
col.HeaderText = "Employee Name";
tableStyle.GridColumnStyles.Add(col);
// Street Address. (DOESN'T WORK)
col = new DataGridTextBoxColumn();
col.MappingName = "Address.Street";
col.HeaderText = "Street";
tableStyle.GridColumnStyles.Add(col);
I have also tried to create a typed collection but that didn't end up
working either.
Thanks in advance for any suggestions you can provide.
Marie Tag: Query Builder Tag: 75838
Sourcegrid
Hi,
I have tried to work with "normal" datagrid, but I think it's not very
flexible.
So I tried SourceGrid (http://www.devage.com), really very flexible.
Probably there's anybody who work with them also:
Here my little problem with the position of my editor, set by my datamodel
As you see in the code below, I use a Datamodel and create my own
EditorControl.
When I enlarge the row heigth, the text in the cell keeps his position
(middleright) but the
editor control always displayed in the top=0 position of the cell.
I have no idea, how I can change this behaviour
Thanks for help
Berthold
// my datamodel
public class NumDataModel : EditorTextBoxNumeric
{
........
......
public override Control CreateEditorControl()
{
TextBoxTypeNumeric l_Control = new TextBoxTypeNumeric(mSeperator);
l_Control.BorderStyle = BorderStyle.None;
l_Control.AutoSize = true;
return l_Control;
}
// my own textbox
public class TextBoxTypeNumeric :
SourceLibrary.Windows.Forms.TextBoxTypedNumeric
{
........
protected override void OnKeyPress ( System.Windows.Forms.KeyPressEventArgs
e )
{
base.OnKeyPress (e);
if (e.KeyChar == mSeperator)
{
if(this.Text.IndexOf(mSeperator) >= 0)
e.Handled = true;
}
}
} Tag: Query Builder Tag: 75837
Could anyone please help me
could anyone please help me..
im using vb.net with crystal report.net tools for reporting.
i use stored procedure for dataset in cr.net,
problem is :
how could i know or did anyone please tell me what should i do when the report contain no record
so that i shouldn't show it for the user.
anyway thx in advanced..
ps : sorry for my bad english..any suggestion will be welcomed
--------------------------------
From: SAFIR CHANG
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>rPGgN296G0uCtz9ShrpdaA==</Id> Tag: Query Builder Tag: 75835
Good old-fashion File Listbox in C#.NET
In VB, there was a simple little control called a file listbox. I want to
implement the same thing as elegantly as possible in C#. I think I do it with
the combination of a DirectoryInfo object and a Listbox control. But I'm not
quite sure how I hook them together. Any help would be much appreciated!
Alex Tag: Query Builder Tag: 75830
How do I populate textbox in a form with .net?
I have successfully built a form page to enter customer info into sqlserver
2000. I would now like to be able to pul it up and edit it in a Winows form
format rather than a datagrid. (Like asp) I have seen it on several
websites including Dell's checkout page. I have been looking for examples of
VB code to do this with no luck.
Here is my dataset and datalist with my feeble attempt at populating a
textbox. (The datalist works fine.) Can someone get me started or send me to
good code examples please?
<code>
<%@ Page Language="VB" Debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script language="VB" runat="server">
sub Page_Load(Sender as Object, e as EventArgs)
Dim objConn As SqlConnection = New SqlConnection("Data Source=localhost;" & _
"Integrated Security=true;UID=Newlogin;PWD=cool147;Initial Catalog=PLF")
dim objCmd as SqlDataAdapter = new SqlDataAdapter _
("select * from Customers where CustomerID like 28", objConn)
dim ds as dataset = new Dataset()
objCmd.Fill(ds, "Customers")
'select data view and bind to server control
MyDataList.DataSource = ds.Tables("Customers"). _
DefaultView
MyDataList.Databind()
objConn.close()
end sub
</Script>
<html>
<head>
</head>
<body>
<link REL="stylesheet" HREF="css/maincss.css" TYPE="text/css">
<form runat="server"><asp:DataList id="MyDataList" RepeatColumns="1"
Repeatdirection="Vertical"
runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "FirstName") %>
<asp:TextBox id="firstname" value="<%# DataBinder.Eval(Container.DataItem,
"FirstName") %>"runat="server" />
<%# DataBinder.Eval(Container.DataItem, "LastName") %><br>
<%# DataBinder.Eval(Container.DataItem, "CompanyName") %><br>
<%# DataBinder.Eval(Container.DataItem, "Address1") %><br>
<%# DataBinder.Eval(Container.DataItem, "City") %>,
<%# DataBinder.Eval(Container.DataItem, "State") %>
<%# DataBinder.Eval(Container.DataItem, "ZipCode") %><br>
<%# DataBinder.Eval(Container.DataItem, "HomeNumber") %><br>
</ItemTemplate>
</asp:DataList>
</Form>
</code> Tag: Query Builder Tag: 75829
disable close button of system menu
When I disable the close button of a form (in MC++)
::EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
::DrawMenuBar(hwnd);
everything works as expected. But when I show a MessageBox the close button
is not gray and appears to be pressed (tested on XP with themes enabled).
Anyway to get it gray in this situation?
Thanks Tag: Query Builder Tag: 75826
Any way to programmatically get a list of all language encodings?
I want to provide a way for the user to select the appropriate language
encoding - the way IE does it when you right-click a page and select
Endcoding. Is there an API somewhere that provides this information?
Btw, I'm using C#, but VBNET examps are always welcome.
TIA Tag: Query Builder Tag: 75823
Catching exceptions thrown by an MDI Child Form separately
Hi All,
How can you capture unhandled exceptions thrown by an MDI child form
separate from the entire app?
I have an application-wide exception handler to catch crashes by doing
the following in my Application entry point:
Public Shared Sub Main()
'Explicitly set apartment state to Single Thread Apartment (STA)
System.Threading.Thread.CurrentThread.ApartmentState =
System.Threading.ApartmentState.STA
Dim eh As New MyExceptionHandler()
AddHandler Application.ThreadException, AddressOf
eh.OnThreadException
Application.Run(New Form1)
End Sub
The form that I'm using to handle this reports/logs the exception and
closes down the application. This works perfectly. I now want to enhance
this functionality by catching unhandled exceptions within individual
MDI Child forms so that I can close down just the child form and not the
entire app. I'm having trouble isolating the exceptions thrown by the
child forms separately. Does anyone have any tips on how best to do this?
Thanks,
--Josh Tag: Query Builder Tag: 75821
Mouse Cursor transparent image
hi,
I wonder if it is possible to make mouse cursor image transparent (using
alpha bending).
thanks. Tag: Query Builder Tag: 75819
Trapping DataGrid initial load (to extract a row, column value for display in a TextBox)
This is a multi-part message in MIME format.
------=_NextPart_000_008D_01C47E12.9185E980
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
We have a DataGrid in one of our forms, and would like to bind one of =
the=20
columns to a TextBox on the form. We almost have the code wired up;
the contents of the TextBox is properly set every time the current row=20
position changes. However, we still haven't figured out how to set the=20
TextBox contents the very first time the DataGrid is loaded.
Can anyone suggest what we can do?=20
Thanks, RD
------=_NextPart_000_008D_01C47E12.9185E980
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>We have a DataGrid in one of our forms, =
and would=20
like to bind one of the </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>columns to a TextBox on the form. We =
almost have=20
the code wired up;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the contents of the TextBox is properly =
set every=20
time the current row </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>position changes. However, we =
still=20
haven't figured out how to set the </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>TextBox contents the very first time=20
the DataGrid is loaded.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone suggest what we can do? =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks, RD</FONT></DIV></BODY></HTML>
------=_NextPart_000_008D_01C47E12.9185E980-- Tag: Query Builder Tag: 75817
Scrollbar questions
Hi,
I'm having two questions regarding the scrollbar control:
1. How can I set the page size? Will I have to do it the "unmanaged" way?
2. How can I tell the scrollbar to look "themed"?
Thanks!
Jens Tag: Query Builder Tag: 75807
Riddle me this: Mdi FormBorderStyle.none code resize vs. border resize
I have a Mdi window with FormBorderStyle.none. I have one user
control (holding a few normal controls) that is set to docking fill in
the Mdi. I use the mouse down, move, and up events on my control to
resize the Mdi. It works. However, as I resize the form the painting
is very choppy, showing the inner controls drawn at different sizes
until I stop resizing. If I turn the FormBorderStyle back on and use
the forms borders to resize I do not see this choppy drawing effect
and it looks great. What am I doing wrong?
Thanks
Bob Tag: Query Builder Tag: 75804
where find a 'color comboBox' as used in Visio?
Hello,
I'm developping a windows forms app in C#, and i wanted to use 'color
combobox box'.
This control is used in Visio:
Tools > options > view > color settings
Is this control a standard control?
where/how can i find it?
Thanks for your help Tag: Query Builder Tag: 75801
How to make some portion of Picture box transparent
Hi friends,
I want to make some portion of image transparent.
I written following code in Paint event of picturebox
Bitmap bmpPic = new
Bitmap(picHeader.Image,picHeader.Width,picHeader.Height);
Color backColor = bmpPic.GetPixel(1,1);
bmpPic.MakeTransparent(backColor);
picHeader.BackgroundImage = bmpPic;
But it is not working please help me
Tushar Tag: Query Builder Tag: 75800
Right to left Menu Bug!!!!
I am writting a MDI application which has a menu bar. I set the Righttoleft
property of Mdi form to "RighToLeft" . But when I run the application the
position of all the menu items in menu bar (top level items) change!!!!. and
after moving mouse cursor on them they will refreshed and be correct.
Please Help me....!!!!!!!! Tag: Query Builder Tag: 75798
What is the best way to moving managed code to unmanaged code?
Hi Group,
I have an application which is web based. I am hosting it on VB.Net
container, ie winform. Now i am facing a problem. If i make an exe of that,
then i require .net framework installed on that machine where i am going to
run this.
So I want to move this managed code to unmanaged side i,e to VC++ by
converting VB.Net code to VB 6.0 and then importing VB 6.0 dll in VC++.
My Question is, Do u people have any better approach to solve this problem?
My Goal is without having framework installed i want to run my app.
Thanks
Sachin Tag: Query Builder Tag: 75793
Owner draw on the MainMenu and MenuItem
Like most fans of eye candy, I've always thought the standard MainMenu
control was a bit drab. After looking at third party components, I decided
to see if I could brute force it into looking nice.
I set the owner draw on the menu items to true, and draw the MenuItems
differently depending on whether or not their selected, thus providing nice
Outlook 2003 menu styling. The only problem is, there is no 'unselected'
event, so I can't redraw the item when the mouse or keyboard has moved
elsewhere. The only thing I could find that semi-worked, was to call an
internal method on the MenuItem object to force a redraw. This works OK for
everything apart from the root level MenuItem. When I try this method on the
root level MenuItem it, for want of a better phrase, spags out and messes up
the painting of the whole form. Not grumbling too much, it is afterall an
internal method.
Anyone know of a way to work with the MainMenu et. al. classes to make them
look nice rather than replacing them?
Cheers,
Tim H Tag: Query Builder Tag: 75788
how to convert object to Forms.Label type ???
I'm developping a windowsForms app in C#
As i created a lot of labels programmaticaly in the form_Load() ispecify the
following to manage the event in the same way for all of my labels:
So in this sub i wanted to call another form with a specific contructor
which set specific values from with the settings of the caller (obviously a
Label)
My code is the following:
private void _ChangeSettings(object sender, System.EventArgs e)
{
//MessageBox.Show(string.Concat("_changeSettings", sender.GetType(),
"//", sender.ToString() ));
//Load Form1 with the caller
if (sender.GetType().ToString() ==
"System.Windows.Forms.Label".ToString())
{System.Windows.Forms.Label lbl = sender;
Form1 f = new Form1(lbl);
f.Closed += new System.EventHandler(this._ChangeLabelSettings);
f.Show();}
}
when i'm building my solution i have the following error
Cannot implicitly convert type 'object' to 'System.Windows.Forms.Label'
How to convert object to Forms.Label????
Thanks for your help Tag: Query Builder Tag: 75778
combobox not clearing
I have a form with 4 combo boxes and several text boxes.
All combos are filled in the form load event.
The first combobox contains names and this is the code to
fill it:
'istantitiate data tier object
mobjUnityGroup = New UnityGroupData
'get the list of names from the data tier
dvNames = mobjUnityGroup.getNames
With cboName
.DataSource = dvNames
.DisplayMember = "Name"
.ValueMember = "ChildID"
.SelectedIndex = -1
End With
All other combo boxes are filled at the same time and the same way (with
different datasource, display member, valuemember).
I select a name and in the selectedindexchanged event, the fields are filled
in and bound to the form. That works fine. However, after editing the
record and saving, by clicking the Save button on the form, I wish to clear
all fields, including the combo boxes. All combo boxes clear except the
cboName.
I another procedure I am setting all combo boxes' selectedindex = 0 and then
selectedindex = -1 per the bug. All works fine except for the name combo
box. I am getting an error "Object reference not set to an instance of the
object"
Anyone have any idea why this is happening? Tag: Query Builder Tag: 75777
form Location Question [please help]
Hi Every One,
How can i load my form above the systray ?
please note that there are systems that the systray is in the right side :-)
Thanks,
T :-) Tag: Query Builder Tag: 75776
Lock part of text in RichTextBox
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C47E22.F0198A50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, friends: =20
Do you know how to lock some of text in RichTextBox? Because I don't =
want user to change what other people have already wriiten in the =
RichTextBox.
Thanks,
Dennis Huang
------=_NextPart_000_000C_01C47E22.F0198A50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi, friends: </FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Do you know how to lock some of text in <FONT=20
size=3D2>RichTextBox? Because I don't want user to change what other =
people have=20
already wriiten in the RichTextBox.</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Thanks,</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Dennis Huang</FONT></DIV></BODY></HTML>
------=_NextPart_000_000C_01C47E22.F0198A50-- Tag: Query Builder Tag: 75772
Outlook like reminder window
Hi
I would like a dialog of reminders to appear on top of all other apps. I
also do not want it to be modal in a way that it blocks the app until it is
closed. This is similar to outlook reminders windows behaviour. Anyway I can
achieve this with vb.net forms?
Thanks
Regards Tag: Query Builder Tag: 75771
RichTextBox Error with AppendText()
I receive an error: "Object reference not set to an instance of an object."
when having this code call which makes no sense as this is a richtextbox
control. I have also placed the trace of this which seems to show this error
occurs within RichTextBox but it doesnt fire the catch. I had to put a
separate startup block in order to even catch this error - otherwise if it
was in the main form it would just fail and disappear with a Windows Forms
error.
Does anyone have a clue what is going on here?
Thanks!
Ben
Private Sub Socks_SessionRemoteDataArrival(ByVal Sender As Object, ByVal
e As ThinkTekLabs.ProxySystem.Base.Session.RemoteDataArrivalEventArgs)
Handles Socks.SessionRemoteDataArrival
Try
Dim s As String = System.Text.Encoding.ASCII.GetString(e.DataB)
RT.AppendText("REMOTE**: " + vbCrLf + s + vbCrLf)
Catch ex As Exception
'MessageBox.Show(ex.Message)
End Try
End Sub
The Try Catch is not triggered and the trace shows the following:
at System.Windows.Forms.RichTextBox.EditStreamProc(IntPtr dwCookie,
IntPtr buf, Int32 cb, Int32& transferred)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.RichTextBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg,
HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at TestExe.startup.Main()
----------------------------------------------------------- Tag: Query Builder Tag: 75769
Copy DataRows to Typed DataSet
Hello,
I developed a custom Windows control that displays a data grid of all orders
for a customer.
Since the control only needs to use the Orders table within the parent data
set (along with the customer ID to filter), it seemed logical to only give
the control what it needs. That's my reasoning for the code below...
\\\
Public Sub New(ByRef Orders As myTypedDataSet.OrdersTable, _
ByVal CustomerID As Integer)
MyBase.New()
InitializeComponent()
dsLocal.Orders = Orders
_Customer_ID = CustomerID
End Sub
Private _CustomerID As Integer
Private dsLocal As myTypedDataSet
Private Sub ctlOrdersForCustomer_Load(ByVal _
sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
myDataView.Table = dsLocal.Orders
myDataView.RowFilter = "CustomerID = " & _CustomerID.ToString
myDataView.Sort = "OrderDate DESC"
myGrid.DataSource = myDataView
End Sub
///
My problem is that I can't pass the Orders table as an argument because it
is part of a typed data set. VS.NET complains about dsLocal.Orders being
read-only in the following statement of the constructor:
dsLocal.Orders = Orders
How can I set the local typed dataset table to the incoming parameter? I've
also tried the Copy, ImportRow, and LoadDataRow methods with no luck. Does
anyone know how this can be done?
Thank you very much!
Eric Tag: Query Builder Tag: 75768
Finding all controls of specified type on a form
I need to find all instances of a specific type of control on a Windows
Form -- for example all DataGrids. The code I came up with is this:
foreach(Control ctrl in this.Controls)
{
if(ctrl.GetType() == Type.GetType("System.Windows.Forms.DataGrid"))
Console.WriteLine(((DataGrid)ctrl).Name);
}
This code has two problems. Something's wrong with the type checking,
because it doesn't find any DataGrids on a form.
Even if it did work, the second problem is that this would find only
DataGrids put directly on the form (in the Form.Controls collection), but a
Grid can also be in the ControlCollection of a GroupBox or some other
container. How to loop through all controls in a form regardless of their
parent control?
Best regards,
Joe Tag: Query Builder Tag: 75766
saveFileDialog - bug & question
Ok, I finally got to .NET development after a long break and i decided to
write an app :)
I started with functionality classes, so my app is currently console, and
what it did (at work) was do something, get big xml document assembled, and
then prompt the user for sme path to save it to and save it.
Here's the basic code (sorry, it's not indented correctly, I posted right
from VS and it doesn't seem to keep indent; well, it is small and simple
anyway):
public static int Main(string[] args)
{
XmlDocument xmlDocument = new XmlDocument();
FileSystemInfoLister xmlFS = new FileSystemInfoLister();
xmlFS.Extension = "mp3";
xmlDocument = xmlFS.GetFileSystemInfoList("e:\\");
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ;
saveFileDialog.FilterIndex = 1;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.OverwritePrompt = false;
saveFileDialog.DefaultExt = "xml";
if ( saveFileDialog.ShowDialog() == DialogResult.OK )
{
xmlDocument.Save(saveFileDialog.FileName);
}
return 0;
}
The classes finsih functioning and the program hangs up. Console window is
up and nothing's happening. If oyu break it, turns out, it is hanging on
"if" line.
I tried moving showdialog to separate line before if - it is hanging on it.
If you step into, step over or continue, it continues hanging; break it and
it is on the same line. No dialog appears. What's happening?
Oh and btw, there's addtional problem with dialog.
When it worked (at work ;) ), the dialog behaved strangely without
saveFileDialog.OverwritePrompt = false;
line. Namely, it returned "Cancel" result when I picked existing file and
confirmed that I want to overwrite it. Why's that? Tag: Query Builder Tag: 75765
Making updates to DataTable/DataGrid from within another thread
Hi all!
In my app I implemented a separate worker thread that handles network
communication using Net.Sockets. It needs to make updates to a
DataTable object, which is displayed to the user by a DataGrid
control. The DataTable object is a 'public static' field instantiated
within context of the main thread.
The problem is that if I add a column to the DataTable from within the
worker thread (eg. different thread than where the DataTable and
DataGrid reside in), all columns suddenly disappear from the DataGrid
view for some reason;
Controller.dataTable.Columns.Add(new DataColumn("TestColumn"));
If I move this code to the main thread, it works fine. After adding
new column, I looked at dataTable with debugger and it seemed fine. So
the culprit must be the DataGrid control. Do I need some kind of
thread synchronization? Tag: Query Builder Tag: 75764
Databinding COM object properties
When attempting to add databindings between a simple COM object properties
and text box fields, I get the following error:
Unhandled Exception: System.ArgumentException: Cannot bind to property or
column Id on DataSource.
Parameter name: dataMember
at System.Windows.Forms.BindToObject.CheckBinding()
at
System.Windows.Forms.BindToObject.SetBindingManagerBase(BindingManagerBase
lManager)
at System.Windows.Forms.Binding.SetListManager(BindingManagerBase
bindingManagerBase)
at System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding
dataBinding)
...
I have a trivial form that contains 3 text boxes (id, first name, last name)
and the form class instantiates the COM object in the constructor. Also in
the constructor, I add the databindings:
public Form1()
{
InitializeComponent();
m_edtId.DataBindings.Add("Text", m_user, "Id");
m_edtLastName.DataBindings.Add("Text", m_user, "LastName");
m_edtFirstName.DataBindings.Add("Text", m_user, "FirstName");
}
The COM object has get/set for these three properties and works fine if I
don't use databinding.
Also, if I replace the COM object with a managed class that has these
properties, I don't have any problems with the databinding.
Thanks for any assistance. Tag: Query Builder Tag: 75763
Deployment Question (networked)
Hi all,
I'm relatively new to .Net and especially the Windows side of it (I come
from a web background).
I have recently started dabbling in Windows apps - one thing I would like to
be able to do is install my application across several PC's on a network,
can anyone suggest how this could be achieved?
My application will be using a small xml file as a config file - I was going
to have one of these present for each install of the application - however I
think it might be better if this was in one central location (ie on the
server) so that a) a normal user would be unable to change it, b) when it
needs changing its only changed in one location - not across 30+ client PC's
etc.
Can anyone advise as to whether this is a good approach - or whether having
a config file for each installation would be better - a bonus of this would
be if the server was ever to fail the client apps could still run as they'd
have their own config files etc.
I have used the Install Wizard in Visual Studio once - and it seemed very
straight forward, and put a pretty front end to the install process - I have
no idea however whether this is particularly customisable, ie, what if I
want to still have a file on each install (client) that tells it where to
get the main config file from - this should be perhaps something entered
during the install yet the Wizard did not seem to give any options for
adding extra information(ie, asking questions) during the install process -
other than the location of where the application would be installed.
Any information at all on this subject would be appreciated.
Kind regards
Rob Meade Tag: Query Builder Tag: 75762
Form Location Question
Hi Every One,
How can i load my form above the systray ?
please note that there are systems that the systray is in the Left side :-)
Thanks,
T :-) Tag: Query Builder Tag: 75760
SendMessage doesn't work when window has ShowInTaskbar set to false
I have two applications, one is sending a message, one is receiving.
The sending app's code is as follows:
------------------------------------------------------------------------
private void Main()
{
Process p = Process.GetProcessesByName("MyApp")[0];
SendMessage(p.MainWindowHandle, 0xA123, IntPtr.Zero, IntPtr.Zero);
}
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
private static extern IntPtr SendMessage(IntPtr hwnd, uint Msg, IntPtr
wParam, IntPtr lParam);
------------------------------------------------------------------------
The code for the window receiving the message is as follows:
------------------------------------------------------------------------
protected override void WndProc(ref Message m)
{
if(m.Msg == 0xA123)
{
MessageBox.Show("Called");
}
base.WndProc(ref m);
}
...
this.ShowInTaskbar = false;
------------------------------------------------------------------------
Messages are not received when ShowTaskbar is set to false. Any ideas
on solving this issue?
Thx Tag: Query Builder Tag: 75757
"sam" <sam@discussions.microsoft.com> wrote in message
news:CB2D06C5-9593-4816-92A0-715B5D0351D0@microsoft.com...
> Anyone know of any .Net controls that can allow an end user to build
queries?