Part 3 | How to Create a Calendar | Display Events | C# | Windows Form
HTML-код
- Опубликовано: 24 окт 2021
- Thanks for watching. If you liked this video, make sure to subscribe for more
PART 1
• PART 1 | How To Create...
PART 2
• Part 2 | How to Create... - Наука
I just had to thank you for the videos. They helped out a lot keep up the good tutorials.
Hi Joe! Thank you for this video !!
How can i add more than one event to a specific date? For Instance your video "Calendar Event Scheuduler". Do you have the code anywhere published ?
Nice master, cant wait to save multiple days like " booking days " waiting for update master.
Great video, it helped me a lot.
Thanks.
wonderful,i have a question can i display all events while I load the calendar or months
Really great video series thank you. Is there no other way of auto updating the calendar view rather than polling the database? it seems like a waste of resources. In this case it isn't too bad, but I have built similar apps using a client to view the data and update. The only way I could do this was using regular polling to update. I did get it working with Service Broker using MSSQL the once, but this proved to be very complicated and not really worth the hassle.
@coding_ideas I need help the event wont show on the calendar after pressing the button. I even checked the timer
good job
can you do a calendar that display events without using SQL server? Thanks
I just wanted to know how to make a mark on today so the user know that we are in November 1st something like that
Hi! When I run the program I have a large number of EventForms open
Why is the event are duplicating after i click to another usercontrol
hello , my timer is doent s uptade after i add event and he s dont show in calenday, any sugestion?
Is it possible that you made a video with a data base?
In the data base, you'll have the month day etc, that when inserted either in the data base or the actual winform, the events would show up
hello, thanks for the suggestion. when i made this video I assume that viewers already know how to make a database :) . i will include database creation next time :) . thank you
is this possible without the database?
Hi Jeov. I have a problem with the syntax of the select statement. I get an error that says incorrect syntax near the "?". I even put the query through the query builder but cannot find the problem. I hope you can shed some light on it for me.
Regards from the UK
Hi Nicola, It seems like there is sth wrong with ur query statemnt. Check your query statement if its correct. Double check if the syntax is correct or if there are no mispelled words .
pls can you give me a link to the github project
Hello, I am having a problem with SQL Server. It does not accept question marks.
how do i do this if i dont have sql please help asap
THANK YOU PO
You're Welcome :)
Hello, nice tutorial and thank you for the video. I have an issue about displaying the text in event calendar. I didn't got an error but the text does not appear after I add an event . I use SqlServer (System.Data.SqlClient) and I used @Date instead "?" in SQL query. Can you help me with this problem? Thank you in advance.
same here did u find a solution ?
same. Any tips?
@@abdelrhmanahmed5131 Hello, I found this solution:
private void displayEvent()
{
SqlConnection con = new SqlConnection(connectionString);
con.Open();
string sql = "SELECT * FROM Event WHERE date= @date";
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.AddWithValue("date", FormAdmin.static_year + "-" + FormAdmin.static_month + "-" + lblDays.Text + lbltime.Text);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
lbevent.Text = reader["Event"].ToString();
lbltime.Text = reader["Time"].ToString();
}
reader.Dispose();
cmd.Dispose();
con.Close();
}
This worked for me.
solution?
Did you guys find a solution?
شكرا جزيلا صديقي عمل رائع
you're welcome :) .
Because I am using SQL Server I had to change the '?' to @Date. Worked fine after that : )
Yes same here, I had to utilize @Date and @ Event as I also used SQL Server
how to change this code into sql server?@@TheGame1083
this is my code guys 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.Threading.Tasks;
using System.Windows.Forms;
namespace HealthCare_Dashboard
{
public partial class UserControlDays : UserControl
{
public static string static_day;
public UserControlDays()
{
InitializeComponent();
}
SqlConnection Con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Armando\OneDrive\Documents\event.mdf;Integrated Security=True;Connect Timeout=30");
private void UserControlDays_Load(object sender, EventArgs e)
{
}
public void days(int numday)
{
ibdays.Text = numday.ToString();
}
private void UserControlDays_Click(object sender, EventArgs e)
{
static_day = ibdays.Text;
timer1.Start();
Form5 eventform = new Form5();
eventform.Show();
}
// create a new method to display event
private void displayEvent()
{
{
Con.Open();
string sql = "SELECT * FROM [Table] WHERE Date = @date";
using (SqlCommand cmd = new SqlCommand(sql, Con))
{
cmd.Parameters.AddWithValue("@date", Form4.static_year + "_" + Form4.static_month + "_" + ibdays.Text);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
lbevent.Text = reader["Event"].ToString();
}
}
}
Con.Close();
}
}
//create a timer for auto display event if new event is added
private void timer1_Tick(object sender, EventArgs e)
{
//call the displayEvent method
displayEvent();
}
}
}
Hello .. did it work when you add event did he show in the calander or no please ?
How to convert it into a sql command?
When i type in a new event on a different date, the previous usercontrolday boxes i clicked on, populate with the exact same event that i just entered, do you know how to fix this?
i have the same problem. Do you know how to fix it?
lods hindi lumalabas ung nilagay ko sa event sa calendar
Helllo, i want to add event with start date and finish date
Can you share the source code?
Necesito la base de datos 😭
bro for me it works it displays it but it displays all the events in my data how do i fix it so that it only shows the events on that day?
sir please send code of display all events
please help, it does not display the name of the event on the calendar, although it is in the database
And also why you need a timer to open display event?
how can i specify today's date
hello, Sorry for the delayed response.
declare a static variable for your month and year in your
main form, and assign a value.
example :
staticMonth = currentMonth;
staticYear = currentYear;
and in your UserControl Days.
create current date variable
example :
currentDate = MainForm.staticMonth + "/" + lbday.text + "/" + MainForm.staticYear;
and compare the currentDate and dateToday. if both are equal u can customize UserControl.
Hey!! you answered everyone except me and one or two people please help
hello, Sorry for the delayed response.
declare a static variable for your month and year in your
main form, and assign a value.
example :
staticMonth = currentMonth;
staticYear = currentYear;
and in your UserControl Days.
create current date variable
example :
currentDate = MainForm.staticMonth + "/" + lbday.text + "/" + MainForm.staticYear;
and compare the currentDate and dateToday. if both are equal u can customize UserControl.
Hi, the event doesn´t appear after i click the button add event
Check your timer :).
@@coding_ideas Ty brother ! , how can i update the year if i click next in december?
@@matias-5050 increment the year :). If its greater than 12 which is the month of december, add 1 to ur year .
@@coding_ideasyou mean : year ++; ?
@@coding_ideas It give me a exception : " The year, month, and day parameters describe a DateTime field that cannot be rendered.' "
Help me pleaseeee 🥹