|
Hi there,
I have created a bll and dal of which the dal consumes web services as its datasource.
Getting the XML from the web service I then create a collection of objects representing the entities.
Which I then might bind to say a gridview/datagrid.
The lead developer is saying that surely you are then doing something twice, looping through the xml to create the collection, then when you databind the collection. Looping through it again? And is asking the wisdom in this, keeping in mind performance?
Should performance here be an issue? Would it be better, to use the XML returned and bind the datagrid directly to that in stead of using the BLL and DAL?
Advice please? :P
|
|
|
|
|
if any body have a miniproject on DataGrid in C# then plz explain it to me.
|
|
|
|
|
Hi there,
I am trying to make this work for the past three days but with no success, i also posted this in the vb.net section as well. I have a windows form application with web browser control integrated into it. What i want is that when ever there is some file download request come along i get the url and download it via System.net classes, if the file is a word,excel or power point document i open them in my other form where i have integrated the word/excel/pp. all the rest of bits are working the only thing left is that i don't know how to intercept file download. I know i have to implement idownloadmanager interface but i can't make it work, my the download method of the interface never get called. the sample code is here (it's in vb.net but if i can work in c# as well)
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Browser As AxSHDocVw.AxWebBrowser
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.Browser = New AxSHDocVw.AxWebBrowser
CType(Me.Browser, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Browser
'
Me.Browser.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Browser.Enabled = True
Me.Browser.Location = New System.Drawing.Point(8, 8)
Me.Browser.OcxState = CType(resources.GetObject("Browser.OcxState"), System.Windows.Forms.AxHost.State)
Me.Browser.Size = New System.Drawing.Size(360, 304)
Me.Browser.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(376, 318)
Me.Controls.Add(Me.Browser)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.Browser, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim url As System.Object = "http://my.mindvision.com/~ben/tools/"
Dim o As System.Object = Nothing
Browser.Navigate2(url, o, o, o, o)
SetDownloadManager()
End Sub
Private m_DownloadManagerCookie As System.Int32
Private Sub SetDownloadManager()
Dim ips As COMVB.IProfferService
Dim objBrowser As Object
Dim ispBrowser As COMVB.UCOMIServiceProvider
Dim ip As IntPtr
Try
' Get a handle to the browser ocx
objBrowser = Browser.GetOcx()
ispBrowser = DirectCast(objBrowser, COMVB.UCOMIServiceProvider)
' Query the browser for the IProfferService interface
ip = ispBrowser.QueryService(COMVB.SID_SProfferService, COMVB.IID_IProfferService)
ips = DirectCast(Marshal.GetObjectForIUnknown(ip), COMVB.IProfferService)
' Proffer the new object as the provider of the IHTMLEditHostinterface handler
ips.ProfferService(COMVB.IID_IDownloadManager, New ServiceProvider, m_DownloadManagerCookie)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Class ServiceProvider
Implements COMVB.UCOMIServiceProvider
Public Function QueryService(ByRef guidService As System.Guid, ByRef riid As System.Guid) As IntPtr Implements COMVB.UCOMIServiceProvider.QueryService
If guidService.Equals(COMVB.IID_IDownloadManager) Then
If riid.Equals(COMVB.IID_IDownloadManager) Then
Dim idm As COM.Interfaces.IDownloadManager
idm = New DownloadManager
' idm.Download()
Return GetInterface(idm, COMVB.IID_IDownloadManager)
Else
Return Nothing
End If
Else
Return Nothing
End If
End Function
Public Function GetInterface(ByVal obj As Object, ByRef iid As Guid) As IntPtr
Dim pUnk As IntPtr
Dim pInterface As IntPtr
Dim hr As Integer
pUnk = Marshal.GetIUnknownForObject(obj)
hr = Marshal.QueryInterface(pUnk, iid, pInterface)
If hr < 0 Then
Marshal.ThrowExceptionForHR(hr)
End If
' Marshal.GetHINSTANCE()
' Marshal.Release(pUnk)
Return pInterface
End Function
End Class
Class DownloadManager
Implements COM.Interfaces.IDownloadManager
Public Function Download(ByVal pmk As System.Runtime.InteropServices.UCOMIMoniker, ByVal pbc As System.Runtime.InteropServices.UCOMIBindCtx, ByVal dwBindVerb As System.UInt32, ByVal grfBINDF As Integer, ByVal pBindInfo As System.IntPtr, ByVal pszHeaders As String, ByVal pszRedir As String, ByVal uiCP As System.UInt32) As Integer Implements COM.Interfaces.IDownloadManager.Download
MsgBox("file download event")
Return New System.Int32
End Function
End Class
Class COMVB
' IServiceProvider interface
<comvisible(true), comimport(),guid("6d5140c1-7436-11ce-8034-00aa006009fa"),="" _
interfacetypeattribute(cominterfacetype.interfaceisiunknown)=""> _
Public Interface UCOMIServiceProvider
Function QueryService(ByRef guidService As Guid, ByRef riid As Guid) As IntPtr
End Interface
' IProfferService interface
<comvisible(true), comimport(),="" guid("cb728b20-f786-11ce-92ad-00aa00a74cd0"),="" _
="" interfacetypeattribute(cominterfacetype.interfaceisiunknown)=""> _
Public Interface IProfferService
Sub ProfferService(ByRef guidService As Guid, ByVal psp As UCOMIServiceProvider, ByRef cookie As Integer)
Sub RevokeService(ByVal cookie As Integer)
End Interface
Public Shared SID_SProfferService As New Guid("cb728b20-f786-11ce-92ad-00aa00a74cd0")
Public Shared IID_IProfferService As New Guid("cb728b20-f786-11ce-92ad-00aa00a74cd0")
Public Shared SID_SHTMLEditHost As New Guid("3050f6a0-98b5-11cf-bb82-00aa00bdce0b")
Public Shared IID_IDownloadManager As New Guid("988934A4-064B-11D3-BB80-00104B35E7F9")
End Class
|
|
|
|
|
Try the VB.Net forum, this is the C# forum.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
i know it is a c# forum but you can implement idownloadmanager in c# as well
|
|
|
|
|
hi cp people!
i still can't found the answer to my question about importing a C++ dll into my C# project...
it's not clear to me ont how to set the value on "EntryPoint=" value when importing dll's
what's exactly do you do when setting the value on the "EntryPoint=" part? let's say i have this dll from an unmanaged C++, when i import it's dll, and there's is a function in it that i want to use, let's say it's function name is MyFunc. do you code like this?
[DllImportAttribute("dllname.dll"), EntryPoint = "MyFunc")]
in order for the function that i want to work?
i'm still new at C#, and this dll importing lessons is taking it's toll on me. hehehe
thanks to all those who will post their replies
regards...
In the land of the blind, the one-eyed man is the king.[^]
|
|
|
|
|
Not sure if this CP article can help, as it's written in C++/CLI, not C#.
Best,
Jun
|
|
|
|
|
Use this (http://www.nirsoft.net/utils/dll_export_viewer.html) to find the entry point of your function. The function name in that list is your EntryPoint. Sometimes is the function name also weird (like this ?ShowHelloWorld.??) Then you must use that weird charachter also to use your dll.
For example, if your dll export viewer show something like this ?ShowHelloWorld.?? then you must write :
[DllImport("dllname.dll"), EntryPoint="?ShowHelloWorld.??"]
private static extern void ShowHelloWorld();
|
|
|
|
|
Hi to all,
Plz, help to develop UDP in C# using Winsock Library. From where I can get a sample code to develop UDP using Winsock Library in C#.
I have develop the code, but it failed to receive data in following code,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MSWinsockLib;
using AxMSWinsockLib;
using System.Net;
using System.Net.Sockets;
namespace @as
{
public partial class Form1 : Form
{
WinsockClass winSockCls;
Object data;
String str;
public Form1()
{
InitializeComponent();
data = new Object();
winSockCls = new WinsockClass();
winSockCls.Close();
winSockCls.DataArrival += new MSWinsockLib.DMSWinsockControlEvents_DataArrivalEventHandler(Socket_DataArrival);
}
private void Form1_Load(object sender, EventArgs e)
{
winSockCls.Protocol = MSWinsockLib.ProtocolConstants.sckUDPProtocol;
winSockCls.RemoteHost = "192.168.0.6";
winSockCls.RemotePort = 12345;
winSockCls.LocalPort = 8080;
str = "Hi Ani";
winSockCls.SendData(str);
}
private void Socket_DataArrival(int bytesTotal)
{
if (winSockCls.State != (short)MSWinsockLib.StateConstants.sckOpen)
return;
winSockCls.GetData(ref data, data.GetType(), bytesTotal);
winSockCls.SendData("AS");
}
}
}
But "GetData()" function is not working. Plz, Help me.
Best Regards & Thanks,
Aniket Salunkhe
|
|
|
|
|
Hi all,
I am working on a chat application in which i want the application to run
on the internet i.e the application should use Http for communication purpose
Any idea about this will be a great help,
Thanks & Regards,
Pramod
|
|
|
|
|
Hello
Even over the internet you can -& should- use TCP/IP for communications.
How about making a WebService that connects all the clients together?
|
|
|
|
|
Thanks!!! for that,
Well can u tell me what technologies are used to create the
MSN messenger and Yahoo messengers?
Thanks & Regards,
Pramod
|
|
|
|
|
Hello again.
What makes you think I know that?? I honestly don't. There are many ways to make chat applications, just like I told you I only chose Tcp. It worked fine with me.
Whatever protocol you choose, I hope it would work fine for you.
|
|
|
|
|
One approach is using Remoting, which allows you to choose between TCP and HTTP channel. Check this CP article out.
Search CP for "chat AND remoting" for more chat apps using Remoting.
Best,
Jun
|
|
|
|
|
hi ,
can ne1 guide me as to how to convert a xsd to xml .... it would be of freat help if you provide me with some sample code for this...
thanks in advance....
regards,
Compdesign
|
|
|
|
|
There's no easy way to do that programmatically. You'll probably have to use a tool like XmlSpy to do it. I could have sworn Studio 2005 did it, but I can't find it now. Maybe that was Xml -> Xsd I'm thinking about.
I have a tool in beta that can do some Xsd -> Xml conversion, but that's no help to you now.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
I am beginer C#. I 'm creating small application which manage list people.
Application can add, remove, move next, comeback element. But I don't know to do a simply linked list to manage list people.
I am doing this application in Console of C#.
I like your help.
Thank you .
|
|
|
|
|
hi
try to use ArrayList or HashTable to implement the linked list
Tamimi - Code
|
|
|
|
|
Hi Tamimi.
Thank you. I try to use Hashtable but I don't know do Hashtable do in this instance.?
If you can do simply example , you can send code to me.
Thank you.
|
|
|
|
|
hi
i think according to your first post, its Easier to use array list
to do the navigation, but still you can implement the link list with
hashtable and arraylist.
feel free to post again
Tamimi - Code
|
|
|
|
|
Hi Tamimi.
Thank you.
I was completed my example.
|
|
|
|
|
how can copy UniCode to Clipboard and then paste it as text ??
as u can see the unicode in this site
http://www.alanwood.net/unicode/basic_latin.html
i want t copy the uniCode of a for example to A=0065 and then pase it as ==> A
Palestine
|
|
|
|
|
Hello
The clipboard is just another space in the memory to exchange data between applications -or sometimes in the same application-. It doesn't matter what format that data is of.
You see, you have to make some sort of a Parse() method to get, validate, and parse the data.
It all depends on in what format you expect your data to be.
eg.
if in the clipboard the data is stored like this:
HHHH HHHH HHHH
you should follow these steps:
1- Read four bytes
2- Validate them
3- Add them to a StringBuilder -just an example-
4- Repeat the cycle Until you reach the end of data
Try checking ClipBoard class in your MSDN
|
|
|
|
|
I'm reading data from the the accelerometer on my thinkpad w/ C#. Here's my problem: It's super super sensitive - it can update (1 value) even if the laptop is sitting still on a table.
Right now I made a library to poll the accelerometer driver on my laptop every 1 ms (with a Timer). On every Timer.Tick, I publish an Event. So, the calling class can subscribe to the OnComputerSlap event (which passes and x and y cord) and do whatever it wishes. However, the event handler is getting called ever 1 ms and I want to set up some type of system where it will only push the event when - for example - the x value increases by 10 since the last reading. Some type of heuristics system. Any ideas on how to do this?
/\ |_ E X E GG
|
|
|
|
|
Can any one help me out how two application can communicate with each other one is web Application and other is Desktop Application.
Rizwan Afsar
Associate Member, Technical Team
IAP Company Ltd, Gurgaon
INDIA
www.iap-online.com
"A winner is not the one who never fails,
But one who NEVER QUITS"
|
|
|
|
|