One man was killed and another was shot this month at parties in Charles County, and the sheriff’s office said news of both parties was spread through social networking, which has been leading to trouble.

“Across the nation and even here,’’ the sheriff’s office said in a statement, police “are responding to more and more reports of parties that get out of control because the party is posted on social media.”

The sheriff’s office urged parents and teenagers to recognize that “social media has changed the way people party.” It said addresses of parties are forwarded to friends, who send the information to additional friends.

Soon, “hundreds of uninvited people show up and in some instances violence has broken out,” according to the sheriff’s warning.

It “may be tempting to go to one of these parties,” the statement said, but those who do could be placing themselves “in a dangerous situation.”

The man who was killed, Jerry Adam Gilchrist, 18, of Cheltenham was involved in an altercation at a party July 7 in the Indian Head area, the sheriff’s office said. He died at a hospital, which reported that he had suffered blunt-force trauma, the sheriff’s office said.

In the second incident, the office said, uninvited guests showed up at a party after learning about it through social networking. After an argument, there was gunfire and a 19-year-old was wounded. An arrest has been made, the sheriff’s office said.