|
Hi
I want types of layout in .net
please help me
|
|
|
|
|
You will have to be more specific as different technologies provide different layouts.
If you are looking for WPF layouts, see here.
Silverlight, too, provides different panels for layouts.
|
|
|
|
|
LayoutKind[^]
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi there! I need some help with datagrid.
How to put a image\ico in the datagrid header column?
Thanks
|
|
|
|
|
One way you can do this is to use the CellsPainting event to draw the
bitmap for a particular header cell. Here is code that does this
assuming the bitmap is in an imagelist.
//this.images is an ImageList with your bitmaps
void dataGridView1_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == 1 && e.RowIndex == -1)
{
e.PaintBackground(e.ClipBounds, false);
Point pt = e.CellBounds.Location;// where you want the bitmap
in the cell
int offset = (e.CellBounds.Width -
this.images.ImageSize.Width) / 2;
pt.X += offset;
pt.Y += 1;
this.images.Draw(e.Graphics, pt, 0);
e.Handled = true;
}
}
Jinal Desai
|
|
|
|
|
Thank you Jinal for the replay,
but that work for the DataGridView. I need to do that in a DataGrid, i have to use framework 1.1
Best regards,
|
|
|
|
|
I am confused; I am using VB2010, IBM.iSeries.DB2 on an as400 V5R4. I am trying to establish an OLEDB connection, and return the values from the selected table to a DataGridView. I had one of the admin’s make me file named GARBAGE, in the Rprtaccess catalog. In the past, I have been able to connect via access and an ODBC connection. My project is too big for access, and the SQL middleware we have is clunky and not user friendly. This is a program that will generate the SQL statements, specifically the WHERE: clause and populate the datagrid with the selected criteria. In essence I am making a user friendly striped down program, that has variables that are manipulated by the end user, and the rest, referenced tables and libraries are coded.
Imports System.Data.OleDb<br />
Imports System.Exception<br />
<br />
<br />
<br />
Public Class Form11<br />
<br />
Public Sub Form11_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
If Not String.IsNullOrEmpty("10.0.0.75\rprtaccess\garbage") Then<br />
<br />
Dim OleDbConn As New OleDbHandler<br />
Dim dgvOleDb1 As New Object<br />
Dim ds As DataSet = OleDbConn.GetDataFromOleDb("10.0.0.75\rprtaccess\")<br />
<br />
Dim OleCm As New OleDbCommand<br />
<br />
<br />
If ds IsNot Nothing Then<br />
<br />
Dim table As New DataTable<br />
table.Locale = System.Globalization.CultureInfo.InvariantCulture<br />
<br />
OleCm.CommandType = System.Data.CommandType.StoredProcedure<br />
OleCm.CommandText = "Select Garbage"<br />
Dim CM As Object = OleCm.CommandText<br />
<br />
<br />
Dim OleDA As New OleDbDataAdapter()<br />
ds = CM.SelectCommand.ExecuteReader<br />
<br />
<br />
<br />
dgvOleDb1 = table.Select<br />
<br />
dgvOleDb1.DataSource = DataGridViewEditMode.EditProgrammatically<br />
dgvOleDb1.DataSource = ds.Tables(0)<br />
End If<br />
End If<br />
End Sub<br />
<br />
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvOleDb1.CellContentClick<br />
<br />
End Sub<br />
Public Sub ShowOleDbException()<br />
Dim mySelectQuery As String = "SELECT column1 FROM table1"<br />
Dim myConnection As New OleDbConnection _<br />
("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=")<br />
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)<br />
<br />
Try<br />
myCommand.Connection.Open()<br />
Catch e As OleDbException<br />
Dim errorMessages As String<br />
Dim i As Integer<br />
<br />
For i = 0 To e.Errors.Count - 1<br />
errorMessages += "Index #" & i.ToString() & ControlChars.Cr _<br />
& "Message: " & e.Errors(i).Message & ControlChars.Cr _<br />
& "NativeError: " & e.Errors(i).NativeError & ControlChars.Cr _<br />
& "Source: " & e.Errors(i).Source & ControlChars.Cr _<br />
& "SQLState: " & e.Errors(i).SQLState & ControlChars.Cr<br />
Next i<br />
<br />
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog()<br />
log.Source = "My Application"<br />
log.WriteEntry(errorMessages)<br />
Console.WriteLine("An exception occurred. Please contact your system administrator.")<br />
End Try<br />
End Sub<br />
<br />
End Class
#Region " Import Section"<br />
Imports System<br />
Imports System.Collections.Generic<br />
Imports System.Text<br />
Imports System.Data<br />
Imports System.Data.OleDb<br />
Imports System.Reflection<br />
Imports System.Runtime.InteropServices<br />
Imports Microsoft.Office.Interop<br />
<br />
#End Region<br />
<br />
<br />
<br />
Public Class OleDbHandler<br />
<br />
' Return data in dataset from OleDb. ' <br />
Public Function GetDataFromOleDb(ByVal a_sFilepath As String) As DataSet<br />
Dim ds As New DataSet()<br />
Dim oOleDbConnection As OleDbConnection<br />
Dim sConnString As String = _<br />
"Provider=IBMDA400.DataSource.1;" & _<br />
"Data source=10.0.0.75;" ' & _<br />
'"User Id=myUsername;" & _<br />
' "Password=myPassword"<br />
oOleDbConnection = New OleDb.OleDbConnection(sConnString)<br />
oOleDbConnection.Open()<br />
<br />
<br />
<br />
Try<br />
oOleDbConnection.Open()<br />
Catch ex As OleDbException<br />
Console.WriteLine(ex.Message)<br />
Catch ex As Exception<br />
Console.WriteLine(ex.Message)<br />
End Try<br />
<br />
' It Represents data table '<br />
Dim dt As New System.Data.DataTable()<br />
dt = oOleDbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)<br />
If dt IsNot Nothing OrElse dt.Rows.Count > 0 Then<br />
For sheet_count As Integer = 0 To dt.Rows.Count - 1<br />
Try<br />
' Create Query to get Data from sheet. '<br />
Dim sheetname As String = dt.Rows(sheet_count)("table_name").ToString()<br />
Dim da As New OleDbDataAdapter("SELECT * FROM [" & sheetname & "]", sConnString)<br />
da.Fill(ds, sheetname)<br />
Catch ex As DataException<br />
Console.WriteLine(ex.Message)<br />
Catch ex As Exception<br />
Console.WriteLine(ex.Message)<br />
End Try<br />
Next<br />
End If<br />
oOleDbConnection.Close()<br />
Return ds<br />
End Function<br />
<br />
<br />
Private Function GetDataOleDb(ByVal a_dtData As System.Data.DataTable) As Object(,)<br />
Dim obj As Object(,) = New Object((a_dtData.Rows.Count + 1) - 1, a_dtData.Columns.Count - 1) {}<br />
<br />
Try<br />
For j As Integer = 0 To a_dtData.Columns.Count - 1<br />
obj(0, j) = a_dtData.Columns(j).Caption<br />
Next<br />
<br />
Dim dt As New DateTime()<br />
Dim sTmpStr As String = String.Empty<br />
<br />
For i As Integer = 1 To a_dtData.Rows.Count<br />
For j As Integer = 0 To a_dtData.Columns.Count - 1<br />
If a_dtData.Columns(j).DataType Is dt.[GetType]() Then<br />
If a_dtData.Rows(i - 1)(j) IsNot DBNull.Value Then<br />
DateTime.TryParse(a_dtData.Rows(i - 1)(j).ToString(), dt)<br />
obj(i, j) = dt.ToString("MM/dd/yy hh:mm tt")<br />
Else<br />
obj(i, j) = a_dtData.Rows(i - 1)(j)<br />
End If<br />
ElseIf a_dtData.Columns(j).DataType Is sTmpStr.[GetType]() Then<br />
If a_dtData.Rows(i - 1)(j) IsNot DBNull.Value Then<br />
sTmpStr = a_dtData.Rows(i - 1)(j).ToString().Replace(vbCr, "")<br />
obj(i, j) = sTmpStr<br />
Else<br />
obj(i, j) = a_dtData.Rows(i - 1)(j)<br />
End If<br />
Else<br />
obj(i, j) = a_dtData.Rows(i - 1)(j)<br />
End If<br />
<br />
Next<br />
Next<br />
Catch ex As Exception<br />
Console.WriteLine(ex.Message)<br />
End Try<br />
Return obj<br />
End Function<br />
<br />
End Class
|
|
|
|
|
Great, but what error(s) are you getting? Without knowing this all you will get are guesses....
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi everyone,i'm trying to develop an application to send an e-mail from my c# windows application
here i'm tis namespace
using System.Net.Mail;
and its my code:::::
private void button1_Click(object sender, EventArgs e)
{
try
{
SmtpClient client = new SmtpClient("192.168.1.15", 808);
MailAddress from = new MailAddress("a@live.com");
MailAddress to = new MailAddress("d@live.com");
MailMessage mail = new MailMessage(from,to);
mail.Body = textBox1.Text;
mail.Subject = " hi da ";
client.Send(mail);
}
catch (SystemException se)
{
MessageBox.Show(se.ToString());
}
finally
{
}
--------------------------------------------------
this is ma code but its work but i'm getting run time error like " failure sending mail, unable to connect to remote server"
in smtpclient class i have given ip address as my host and port id.....
pls help me to resolve tis error
modified on Friday, April 16, 2010 4:23 AM
|
|
|
|
|
Do you have an smtp server running at 192.168.1.15:808 ?
probably not.
You should use the smtp relay host that your isp has given you. (use the fqdn, not the ip-address) If you don't have mail at an isp, this won't work. (live.com does not provide smtp relay services). Also, your isp may limit the from: address, and may require authentication when sending mail.
|
|
|
|
|
hi their,u have told me to use fqdn instead of smtp
class n also u have mentioned tat "live.com does not provide smtp relay services" then which mail portal does support to send mails without any limitation or minimum limitation...
how do i find fqdn....?
could u give the exact coding to accomplish my task?
|
|
|
|
|
fqdn means fully qualified domain name. Try Google if you don't understand a word.
What you're looking for is an 'open smtp relay' (look it up before replying). Technically not illegal, but if you find one, your mail will probably be blocked by the recipient's ISP. Are you trying to get into the spam business?
You will have to set up your own smtp server if you want to send mail without limitations, but if you start spamming,
expect
1) Your Internet account to be closed down by your ISP
2) If you're really good at it, a visit from the Feds. (CAN-SPAM act of 2003).
If your intentions are pure, have a look at this list: http://www.iopus.com/guides/bestpopsmtp.htm[^]
|
|
|
|
|
i saw about fqdn in google ...
but my aim is not to get into spam business...its just for my learning only actually i wanna to develop a application just like outlook n i'm student so i'm wanna to learn it. i wan code for my gmail account....once if i go through tat sample code then i ll become much clear...could u post any sample code?if yes pls post it soon because i'm eager to learn it
|
|
|
|
|
|
hey thanks friend...
its works now..now i realized my problem..
actually i was sending from firewall enabled machine ..after i gone through tat code n its commands i turn off my proxy n i sent mail then i worked ...once again tanks michal
|
|
|
|
|
i was working in proxy enabled machine.after i turn off it then it works but again i got different run time error n the exception was "smtp requires secure connection or client was not authenticated".it sent few failure notice to my mail id. pls help me to resolve tis problem
|
|
|
|
|
You will probably have to turn on SSL (secure sockets layer) to get access to server. Turn on the EnableSsl property of your SmtpClient object. You may also have to select another port to send on. Talk to whoever is administering the smtp server, or read any documentation for this smtp server. If you already can send mail through this server, from another program (outlook, or windows mail, or whatever), lookup the connection parameters in that program.
Here is full example of mail client that uses SSL: http://www.codeproject.com/Articles/66257/Sending-Mails-in-NET-Framework.aspx[^]
|
|
|
|
|
Hi
i am very new to this forum and with this technology as well, I need to stream a live video from a multicast IP and need to display it on a website using silverlight player.
The video format is mpeg4. Silverlight player and IIS service is not mendatory if anybody knows any better way to do it than also its fine. Any kind of help will be highly appriciated. Please let me know if i can be more specific about my question.
Eagerly waiting for reply.
|
|
|
|
|
Hi
I am creating custom collection object that inherits arraylist, ienumerable, etc. Because I can't go for Generic list since, that doesn't have event support (insert, add, remove, etc...)
I need some events to be raised on item add/remove/insert on list
public class CustomList<T> : ArrayList, IBindingList , IArrayList<T>
this supports linq, if I use object type in the linq query
var aa = (from User a
in users
where a.IsDirty == false
select a).ToList();
The problem, i could not use extension methods (.Where, etc..)
public class CustomList<T> : ArrayList, IBindingList , IArrayList<T>,IEnumerable<T>, IEnumerable
public new IEnumerator<T> GetEnumerator()
{
return this.GetEnumerator();
}
But this doesn't filter the objects in the list. for example users.Where(a=>a.isDirty == true);
Also if I inherit Ienumerable I get 'System.StackOverflowException' exception.
Please help
Anand
modified on Thursday, April 15, 2010 2:55 AM
|
|
|
|
|
|
list supports add, removve, insert . But I think it doesnt support events
public interface IArrayList<T>
{
int Add(T value);
void Clear();
//bool Contains(T value);
//int IndexOf(T value);
void Insert(int index, T value);
void Remove(T value);
void RemoveAt(int index);
|
|
|
|
|
I think you're confusing events with methods. Read the documentation again.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
my issue is not events/methods, how to incorporate the linq, extention support in to custom list.
public class CustomList<T> : ArrayList, IBindingList , IArrayList<T>,IEnumerable<T>, IEnumerable
{
public new IEnumerator<T> GetEnumerator()
{
return this.GetEnumerator();
}
}
1.
var aa = (from User a
in users
where a.IsDirty == false
select a).ToList();
this works, but public new IEnumerator<T> GetEnumerator() throws stackoverflow exception.
2. users.Where(a=> a.IsDirty == false);
this always returns empty/null
|
|
|
|
|
The problem is you are trying to create something that already exists
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
linq, extension methods work after casting the objects.
public class CustomList<T> : ArrayList, IBindingList , IArrayList<T>
I removed IEnumerable from the customList
users.Cast<User>().Where(a=> a.IsNew).ToList()
var aa = (from User a
in users
where a.IsDirty == false
select a).ToList();
modified on Friday, April 16, 2010 12:59 AM
|
|
|
|