|
Hello,
I have a ListView which has a small ellipsis button that I place dynamically.
The problem is I am not able to reposition the button when I scroll the Listview horizontally.
Any suggesstion is valuable to me.
Thanks
Alomgir Miah
Live Life King Size
-- modified at 14:02 Friday 14th October, 2005
|
|
|
|
|
Hi
I am in the process of developing a web application (well, kind of parital migration as the database storprocedures are going to be reused and the old app which was in vb6/asp is being re-written in ASP.NET) and had some questions with the data layers. I am using custom business entities to repesent business objects and these entities also have the CRUD methods for data access. I modelled it based on the Time Tracker Starter kit at http://www.asp.net and also the samples from enterprise library june 2005 version. I read numerous articles abt this and got confused.
I am not sure if it is a good approach to have the CRUD methods in the custom business entity or have it in a separate data layer component.
I have posted a sample code for a business entity that is used in my add.
Any suggestions / comments to make it a better solution would really be appreciated.
Thanks
Please
<br />
public class User<br />
{<br />
private string _oneWorldID;<br />
private string _lastName;<br />
private string _firstName;<br />
private string _middleInitial;<br />
private string _respDivName;<br />
private string _accessLevel;<br />
private string _activeInd;<br />
private int _respDiv;<br />
<br />
public enum Select<br />
{<br />
Active="Y",<br />
InActive="N",<br />
All=""<br />
}<br />
public User(string sOneWorldID)<br />
{<br />
OneWorldID = sOneWorldID;<br />
FirstName = LastName = MiddleInitial = string.Empty;<br />
RespDivName = ActiveInd = string.Empty;<br />
RespDiv = 0;<br />
}<br />
<br />
public User()<br />
{<br />
User(string.Empty);<br />
}<br />
<br />
public string OneWorldID<br />
{<br />
get {return _oneWorldID;}<br />
set {_oneWorldID = value;}<br />
}<br />
public string FirstName<br />
{<br />
get {return _firstName;}<br />
set {_firstName = value;}<br />
}<br />
public string LastName<br />
{<br />
get {return _lastName;}<br />
set {_lastName = value;}<br />
}<br />
public string MiddleInitial<br />
{<br />
get {return _middleInitial;}<br />
set {_middleInitial = value;}<br />
}<br />
public string RespDivName<br />
{<br />
get {return _respDivName;}<br />
set {_respDivName = value;}<br />
}<br />
public int RespDiv<br />
{<br />
get {return _respDiv;}<br />
set {_respDiv = value;}<br />
}<br />
public string ActiveInd<br />
{<br />
get {return _activeInd;}<br />
set {_activeInd = value;}<br />
}<br />
public string AccessLevel<br />
{<br />
get {return _accessLevel;}<br />
set {_accessLevel = value;}<br />
}<br />
<br />
public bool GetUsersDetails()<br />
{<br />
bool bUserFound = false;<br />
Database sqldb = DatabaseFactory.CreateDatabase("GatewaySQL");<br />
DBCommandWrapper sqlCommandWrapper = sqldb.GetStoredProcCommandWrapper("sp_Select_User_List");<br />
<br />
Utils.BuildParameters( sqlCommandWrapper, <br />
Utils.ParameterCount.SingleParameter,<br />
new object[]{"@ONW",System.Data.DbType.AnsiStringFixedLength,4,ParameterDirection.Input,this.OneWorldID}<br />
);<br />
<br />
using (IDataReader dr = sqldb.ExecuteReader(sqlCommandWrapper))<br />
{<br />
while (dr.Read())<br />
{<br />
this.LastName = dr.GetValue(1).ToString();<br />
this.FirstName = dr.GetValue(2).ToString();<br />
this.MiddleInitial = dr.GetValue(3).ToString();<br />
this.RespDivName = dr.GetValue(4).ToString();<br />
this.ActiveInd = dr.GetValue(5).ToString();<br />
this.AccessLevel = dr.GetValue(6).ToString();<br />
bUserFound = true;<br />
}<br />
return bUserFound;<br />
} <br />
}<br />
<br />
<br />
public static UsersCollection GetUsers(int iRespDiv, User.Select select)<br />
{<br />
Database sqldb = DatabaseFactory.CreateDatabase("GatewaySQL");<br />
DBCommandWrapper sqlCommandWrapper = sqldb.GetStoredProcCommandWrapper("sp_Select_User_List");<br />
<br />
string sActiveInactiveInd = "";<br />
switch (select)<br />
{<br />
case User.Select.Active:<br />
ActiveInactiveInd = "Y";<br />
break;<br />
case User.Select.InActive:<br />
ActiveInactiveInd = "N";<br />
break;<br />
}<br />
<br />
Utils.BuildParameters( sqlCommandWrapper, <br />
Utils.ParameterCount.MultipleParameters, new object[]{"@iRespDiv",System.Data.DbType.Int32,4,ParameterDirection.iRespDiv},<br />
new object[]{"@ActiveInactiveInd",System.Data.DbType.AnsiStringFixedLength,1,ParameterDirection.Input,sActiveInactiveInd}<br />
);<br />
<br />
using (IDataReader dr = sqldb.ExecuteReader(sqlCommandWrapper))<br />
{<br />
UsersCollection users = new UsersCollection();<br />
while (dr.Read())<br />
{<br />
User usr = new User();<br />
usr.OneWorldID = dr.GetValue(0).ToString();<br />
usr.LastName = dr.GetValue(1).ToString();<br />
usr.FirstName = dr.GetValue(2).ToString();<br />
usr.MiddleInitial = dr.GetValue(3).ToString();<br />
usr.AccessLevel = dr.GetValue(4).ToString();<br />
usr.ActiveInd = dr.GetValue(5).ToString();<br />
}<br />
return users;<br />
} <br />
}<br />
<br />
public void InsertUser(string sUpdt_User_OneWorldID)<br />
{<br />
try <br />
{<br />
using (new EntServicesProvider())<br />
{<br />
Database sqldb = DatabaseFactory.CreateDatabase("GatewaySQL");<br />
DBCommandWrapper sqlCommandWrapper = sqldb.GetStoredProcCommandWrapper("sp_Insert_User");<br />
<br />
Utils.BuildParameters( sqlCommandWrapper, <br />
Utils.ParameterCount.MultipleParameters,<br />
new object[]{"@OWN",System.Data.DbType.StringFixedLength,9,ParameterDirection.Input,this.UserID}, <br />
new object[]{"@firstName",System.Data.DbType.StringFixedLength,40,ParameterDirection.Input,this.FirstName},<br />
new object[]{"@lastName",System.Data.DbType.StringFixedLength,40,ParameterDirection.Input,this.LastName},<br />
new object[]{"@middleInitial",System.Data.DbType.StringFixedLength,40,ParameterDirection.Input,this.MiddleInitial},<br />
new object[]{"@accessLevel",System.Data.DbType.StringFixedLength,1,ParameterDirection.Input,this.AccessLevel},<br />
new object[]{"@activeInd",System.Data.DbType.StringFixedLength,1,ParameterDirection.Input,this.ActiveInd},<br />
new object[]{"@respDiv",System.Data.DbType.Int16,2,ParameterDirection.InputOutput,this.RespDiv} <br />
);<br />
<br />
using (IDbConnection connection = sqldb.GetConnection())<br />
{<br />
connection.Open(); <br />
sqldb.ExecuteNonQuery(sqlCommandWrapper);<br />
}<br />
SQLTransactionLog.InsertTransaction( "Insert",<br />
sUpdt_UserID,<br />
"SQL",<br />
"sp_Insert_User",<br />
this.Id,<br />
this.RespDiv.ToString(),<br />
"Secondary column contains User's Division ID." );<br />
<br />
ContextUtil.SetComplete();<br />
}<br />
}<br />
catch (Exception e)<br />
{<br />
ContextUtil.SetAbort();<br />
throw new Exception (e.Message);<br />
}<br />
}<br />
<br />
}<br />
<br />
|
|
|
|
|
How to use function of VB.NET in C#
for example: when i want to use IsNumeric function of VB.NET in C#.
Thanks
I tried so hard and got so far
|
|
|
|
|
I think this would work, haven't had time to test it though
add a reference to the Microsoft.VisualBasic.dll
Microsoft.VisualBasic.Information.IsNumeric( Object )
HTH
Russ
|
|
|
|
|
Well the crazy way would be
bool isnumeric = false;
try
{
Convert.Int32(Object)
}
catch
{
isNumeric = true;
}
//use the isnumeric now
|
|
|
|
|
Not quite...
the isNumeric=true; has to follow the Convert.ToInt32() .
Or use Double.TryParse() to test without having to throw excaptions.
Regards,
mav
|
|
|
|
|
I'm trying to get MSMQ to talk to my application.
I will be using com+ when i'm done, but for the moment i'm using a standalone exe, just to get the idea of things.
I've set up the app using static void Main(Args[]) and i can get the parameters. Apart from the message body. I've converted the string that i get passed to the correct format but i'm missing the final character. It's using xmlserialization for the moment so i've just added a > on the end and my code works, but i'll be switching to binary later so i won't be able to predict what the character is meant to be.
Anyone got any idea how this should work?
Thanks
Russ
|
|
|
|
|
Hello,
I need to create a IE Extension in C#. I want to add a button to IE standard toolbar and then make IE call the DLL when button is clicked.
I have started with the following code
<br />
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]<br />
public struct OLECMDTEXT<br />
{<br />
public uint cmdtextf;<br />
public uint cwActual;<br />
public uint cwBuf;<br />
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]public char rgwz;<br />
}<br />
[StructLayout(LayoutKind.Sequential)]<br />
public struct OLECMD<br />
{<br />
public uint cmdID;<br />
public uint cmdf;<br />
}<br />
[ComImport,<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br />
public interface IOleCommandTarget<br />
{<br />
void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds,<br />
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] <br />
OLECMD[] prgCmds, ref OLECMDTEXT CmdText);<br />
void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, <br />
ref object pvaIn, ref object pvaOut);<br />
}<br />
[ClassInterface(ClassInterfaceType.None),<br />
ComSourceInterfaces(typeof(COM_Events))]<br />
public class COMAddin: IOleCommandTarget<br />
{<br />
public void QueryStatus(ref Guid pguidCmdGroup, <br />
UInt32 cCmds, OLECMD[] prgCmds, ref OLECMDTEXT CmdText)<br />
{<br />
}<br />
public void Exec(ref Guid pguidCmdGroup, uint nCmdId, <br />
uint nCmdExecOpt, ref object pvaIn, ref object pvaOut)<br />
{<br />
}<br />
}
But I don't know what to do next.
I know that I have to add a key in HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions.
And I have to somehow register the COM DLL (regasm?), and create some GUIDs. I don't know where to put those GUIDs, in which class, should I do it over attributes or over assembly... This is a managed DLL, all articles that I find on the net are related to plain native C++. And I need to get the IE Document data somehow (IHTMLDocument2 or something?), but that is not primary here.
Can anyone point me to a good article for this, or help me directly?
Thank you in advance,
Milos
|
|
|
|
|
I have a picture box inside a panel control. AutoScroll property for the panel is set to true. picture box is large enough to show the horizontal or vertical scrollbars of the panel control.
I am trying to Crop the picture box (with RubberBand effect).
When I bring the mouse near the Right Or Bottom Edge of the panel control, the panel control does not scroll.
Can somebody help scroll the panel control?
A code snippet will surely save me some time.
|
|
|
|
|
I'm not certain but I suspect you'll need to do this manually. I can't think of a way to do so without using a 2nd thread though.
My thought is using the MouseMove event, getting the mouse position out of the event args, and if it's within N pixels of the border, starting a thread to scroll the image one pixel N times/sec. IF the mouse isn't within N pixels terminate the scrolling thread (if neccesary).
|
|
|
|
|
I'm using an fsw to monitor a shared save directory for my application, the problem is that when my app saves the datafile the Changed event fires 4 times for the file.
-- modified at 9:51 Friday 14th October, 2005
Make that upto 4 times, with a larger file it's only firing twice.
|
|
|
|
|
Which events and how many times they fire depends HEAVILY on how your application is saving the file. For example, when you open a Word document, it makes a copy of the original file, with a temp filename, and opens the copy. When you save your changes, the file is saved to the copy, then the original file is deleted and the copy renamed to the original filename.
There are no settings to filter out multiple firings of the events.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok. The update I'm doing doesn't cause enough of a performance hit to matter, I was just worried I was doing something wrong.
The files are xml, and except for xml version descriptor, and a comment are written entirely by an xml serializer so there's not much I can do to influence the write behavior.
|
|
|
|
|
I show the client a message via messagebox.
But message is not shown as formatted.
For example
Do you want to delete Record?
ID : 3
NAME : Angel Koverk
CLASS : 4
I like it will shown as
Do you want to delete Record?
ID____: 3
NAME_: Angel Koverk
CLASS_: 4
how can i do?
|
|
|
|
|
Did you try the "\t" escape sequence?
string msg = "Do you want to delete Record?\nID\t: 3\nNAME\t: Angel Koverk\nCLASS\t: 4";
www.troschuetz.de
|
|
|
|
|
Hi your MessageBox should be like this
MessageBox.Show("Do you want to delete Record?" +"\n" + "ID:" +"\t" + "3"+ "\n"+ "NAME:"+ "\t" +"Angel Koverk"+ "\n" +"CLASS:"+ "\t" + "4" );
Regards
|
|
|
|
|
Is it possible to tell when the OS starts and stops a screensaver, from inside a C# service which is running under the SYSTEM account?
-- modified at 6:06 Monday 17th October, 2005
|
|
|
|
|
Hai all
I am working on project inwhich i ahve to dislay the live telecast of an video capturing device at one corner of the winform.
Please suggest me a control which can slove my problem.
Advance thanks.
sukanyavarma
|
|
|
|
|
use directx.Capture namespace
Mess With The Best And Die Like The Rest
|
|
|
|
|
Dear snouto,
Thanks for your information.
I think it is an activex control.
I am trying to write wrapper for inter operability.
Regards
SukanyaVarma
Sukanyavarma
|
|
|
|
|
I have a system where several accounts can exist, in several flavours. I decided to use XML files for storage where each account gets it's own file. At startup, the system loads all accounts in memory.
Have a look at this class diagram.
When mass deserializing, I don't know how to specify of what type (Administrator, Business or Member) an account will be. I tried setting up the deserializer with the root type (Account) but any attempt throws an error about unexpected type.
XmlSerializer serializer = new XmlSerializer(typeof(Account));
Then I tried specifying extra types but the same error arises.
XmlSerializer serializer = new XmlSerializer(typeof(Account), new Type[] { typeof(Administrator), typeof(Business), typeof(Member) });
Any idea how this problem could be resolved?
|
|
|
|
|
I use raw data printing in an accountancy program. XP Clients has no problem with that , but i cannot print any report from Windows me client..
And i use Oki 520 and 310 printers, they have three mode for Fonts ("NLQ","HSD","UTILITY") to print. But i cannot choose which one will be used when printing. I s there any method. Thank you.
|
|
|
|
|
Cross-posting to multiple forums is considered rude, so don't do it please.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi!
i've a question about Trace.
i want to use the trace (System.Diagnostic nemaspace) mechanism to generate (on demand) error and/or state messages for the eventlog. but it's only possible to generate information messages (Type=Information), no warnings or errors?! or is it possible anyway?
here's my code:
TraceListener Listener=new EventLogTraceListener("myApp");
Trace.Listeners.Add(Listener);
...
void doSometing()
{
try
{
}
catch(Exception e)
{
Trace.WriteLine(e.Message,"Error");
}
}
thanks in advance!
|
|
|
|
|
If you're wanting specifically to work with the eventlog, try using the System.Diagnostics.EventLog class. This will provide all of the writing methods you will need -- including writing an "error" event.
|
|
|
|
|