|
That's because your SMTP server doesn't allow mail relay. The from address has to be an account on the SMTP server, or it won't send.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Good Day,
My organization (School Club) will give a seminar. All attendees will get a certificate for attending the seminar.
All of the Attendees information will be saved on a database.
Basically, the Certificate was already designed using Photoshop. However, details like Name, Control Number and Date Printed needs to be filled-up.
I'm thinking of having 3 textboxes placed on top of the Imagebox (the Certificate Image), filling the textboxes with the name, control number and date, and then printing it. However, I don't know how to proceed.
What can you guys suggest?
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
I think you should use Crystal Report. Design your Certificate on Crystal Report [ that alredy designed as image ] please Value field and Print !!!!
|
|
|
|
|
Abhijit Jana wrote: should use Crystal Report
He could, but it might not be cost-wise beneficial for him since it for the school club. Clubs are usually on a tight budget of what they can spend. You might want to suggest something freeware for him to check out.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
You could just do something along the lines of using the PrintDocument class in your app for adhoc reporting. If not, there are plenty of free reporting tools out there, this google search on freeware reporting tools for .net[^] turned up a few good ones. Report Sharp Shooter Express is a nice one.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi,
I am using Save As Dailog box in my application. On running the application, when i try to save a file using Save As dialog box, i found a strange problem. When selecting "My computer" directly, the drives ( c:, d: ) are not visible. however when clicking on drop down box, the whole tree is visible(i.e My Desktop--> My Computer --> C:, D: etc). on doing some r&d i found out that this problem is with OS Windows XP only as with other OS, the above problem doesnt exists. Further my application applies MTA apartments.On shifting to STA, it works fine even with XP OS. Please help me out as i am bound to use Windows XP and MTA.
Regards
Saumik V
|
|
|
|
|
Hi, As i want the small example on how to write a function to insert an integer into a sorted array of integers using c#.Net. So can anybody help me in this regard?
|
|
|
|
|
Try this code;
public int[] InsertToArray(int[] arr, int myInt)
{
int index = 0;
<code>
if (myInt <= arr[0]) <code>
index = -1;
else if (myInt >= arr[arr.Length -1]) <code>
index = arr.Length-1;
else
{
for (int k = 0; k < arr.Length - 1; k++)
if (arr[k] <= myInt && myInt <= arr[k + 1])
index = k;
}
<code>
int[] newArr = new int[arr.Length + 1];
Array.Copy(arr, 0, newArr, 0, index + 1);
newArr[index+1] = myInt;
Array.Copy(arr, index + 1, newArr, index + 2, arr.Length - index - 1);
return newArr;
}
zafer
|
|
|
|
|
Hi Zafer,
Thank you for your assistance.
Regards,
Sami.
|
|
|
|
|
Creating a new array seems rather inefficient.
Instead you should test to see if the value will fit and only extend the array (or throw an Exception) if the new value won't fit.
Edit: Oh, right, an array doesn't keep track of how many items you have in it... you'll need to track that on your own.
modified on Saturday, August 23, 2008 10:44 AM
|
|
|
|
|
And perhaps copy to the new array while searching for the index.
|
|
|
|
|
Use a generic list, add all of your elements, and then call the list Sort() method.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I want to set and focus to a specified node in treeview.it means I want to go to specified node in treeview
How can I do it ?
Hello Friends
|
|
|
|
|
Iterate through your treeview until you find the one you need, then set the treeviews SelectedNode property and call the selectednode's EnsureVisible method.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Simply you can find tree node within treeview using the find method as show below
string myNodeName="abc"
TreeNode[] node=new TreeNode[1];
node=treeView1.Nodes.Find(myNodeName,true);
treeView1.SelectedNode=node[0];
this is simple way how u can find your node within the treeview
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
I HAVE ALREADY ANSWERED THIS. There is no reason to repost it.
Everything makes sense in someone's mind
|
|
|
|
|
I have a 512x512 image, and using lockbits and unsafe code, i visit each pixel to retrieve that pixel value. This is a grayscale image.
What i want to do is start the retrieval from the 256th pixel in each row (or, collectively, the right half of the image).
Heres what i tried:
inputImg = Image.FromFile(inputImgPath);
b = (Bitmap)inputImg;
BitmapData bmData = b.LockBits(new Rectangle(256, 0, b.Width, b.Height),
ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
unsafe
{
byte* p = (byte*)(void*)Scan0;
int nOffset = stride - 256;
for (int y = 0; y < b.Height; ++y)
{
for (int x = 0; x < 256; ++x)
{
current = (byte)p[0];
p++;
}
p += nOffset;
}
}
b.UnlockBits(bmData);
The problem is occurs when i use the LockBits method. The compiler says the parameter is not valid.
modified on Saturday, August 23, 2008 12:33 AM
|
|
|
|
|
gigahertz205 wrote: The compiler says the parameter is not valid.
What parameters is it supposed to take? Does it take the Rectangle object?
---modified
Try using the code block button to make your code snippet easier to read.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
The parameters are as follows:
public System.Drawing.Imaging.BitmapData LockBits(System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format)
And the rectangle:
public Rectangle(int x, int y, int width, int height)
This worked when my starting point was at (0,0) and visited every single pixel in the image, but when its at (256,0), it gives me back an error.
EDIT: this is where i got the code from (http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx[^])
|
|
|
|
|
You might want to ask the author, Christian, in the said article's message board.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I am using the code below to view list of car brands below car makes but while loading i get the above error and i guess it's because the car make value is null during loading. I tried to use if (cboVehicleMake.SelectedItem == null) but still getting the same error.
what can i do?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Rent_A_Car
{
public partial class frmMain : Form
{
SqlConnection sql_connection = null;
SqlCommand sql_command = null;
SqlDataAdapter sql_adapter;
// DataTable data_table = null;
SqlDataReader sql_reader = null;
DataSet data_set = null;
public frmMain()
{
InitializeComponent();
}
private void hide_panels()
{
panelVehicles.Visible = false;
panelVehicleDetails.Visible = false;
}
private void get_vehicle_makes()
{
try
{
sql_connection = new SqlConnection("Data Source=.\\SQLEXPRESS;initial catalog=rent_a_car_company;integrated security=true;");
sql_connection.Open();
sql_command = new SqlCommand("sp_get_vehicle_makes", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
// Create data adapter object
sql_adapter = new SqlDataAdapter();
sql_adapter.SelectCommand = sql_command;
// Create a dataset object and fill with data using data adapter's Fill method
data_set = new DataSet();
sql_adapter.Fill(data_set, "vehicle_makes");
// Attach dataset's DefaultView to the combobox
cboVehicleMake.DataSource = data_set.Tables["vehicle_makes"].DefaultView;
cboVehicleMake.DisplayMember = "vehicle_make";
cboVehicleMake.ValueMember = "vehicle_make_id";
cboVehicleMake.SelectedValue = -1;
}
// catch (Exception oE)
// {
// MessageBox.Show("Problem Populating Reader Box: [" + oE.ToString() + "]");
// }
finally
{
if (sql_reader != null) sql_reader.Close();
// if (sql_connection != null)
// {
// if (sql_connection.State == ConnectionState.Open)
// sql_connection.Close();
// }
}
}
private void get_vehicle_brands_by_make()
{
try
{
sql_connection = new SqlConnection("Data Source=.\\SQLEXPRESS;initial catalog=rent_a_car_company;integrated security=true;");
sql_connection.Open();
sql_command = new SqlCommand("sp_get_vehicle_brands_by_make", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.Add("@vehicle_make", SqlDbType.Int).Value = Convert.ToInt32(cboVehicleMake.SelectedValue);
// Create data adapter object
sql_adapter = new SqlDataAdapter();
sql_adapter.SelectCommand = sql_command;
// Create a dataset object and fill with data using data adapter's Fill method
data_set = new DataSet();
sql_adapter.Fill(data_set, "vehicle_brands");
// Attach dataset's DefaultView to the combobox
cboVehicleBrands.DataSource = data_set.Tables["vehicle_brands"].DefaultView;
cboVehicleBrands.DisplayMember = "vehicle_brand";
cboVehicleBrands.ValueMember = "vehicle_brand_id";
cboVehicleBrands.SelectedValue = -1;
}
// catch (Exception oE)
// {
// MessageBox.Show("Problem Populating Reader Box: [" + oE.ToString() + "]");
// }
finally
{
if (sql_reader != null) sql_reader.Close();
// if (sql_connection != null)
// {
// if (sql_connection.State == ConnectionState.Open)
// sql_connection.Close();
// }
}
}
private void toolExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void navNewVehicle_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
{
if (panelVehicleDetails.Visible != true)
{
// hide all panels;
hide_panels();
get_vehicle_makes();
// panelVehicleDetails.Width = 635;
// panelVehicleDetails.Height = 435;
// panelVehicleDetails.Top = 200;
// panelVehicleDetails.Left = 52;
panelVehicleDetails.Location = new System.Drawing.Point(navMain.Width + 5, navMain.Top);
panelVehicleDetails.Size = new Size(this.Width - navMain.Width - 40, navMain.Height);
panelVehicleDetails.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
panelVehicleDetails.Visible = true;
/*
Control control_name = panelVehicleDetails;
control_name.Name = "panelVehicleDetails";
control_name.Width = 635;
control_name.Height = 435;
control_name.Top = 200;
control_name.Left = 52;
* */
}
}
private void navOurVehicles_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
{
hide_panels();
}
private void cboVehicleMake_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboVehicleMake.SelectedItem == null)
{
return;
}
else
{
get_vehicle_brands_by_make();
}
}
}
}
|
|
|
|
|
1 - don't post so much code
2 - tell us what line your code crashes on
3 - use the debugger to see what object is causing the crash, and give us more info that way, too
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
the line causing the problem is this:
sql_command.Parameters.Add("@vehicle_make", SqlDbType.Int).Value = Convert.ToInt32(cboVehicleMake.SelectedValue);
i guess because during the combobox creation it's still filling the values so it will find null value in the vehicle make but i don't know why thought i am populating the vehicle makes first?!
|
|
|
|
|
i am developing a desktop windows for application but i don't want to include the sql management express with the application therefore i want some way to do my sql statement (in case of troubleshooting) and i want to that from the same application (via admin user)
so if i place a textbox to enter the sql statements how can i view the output?
|
|
|
|
|